Total Lines | 18 |
Duplicated Lines | 0 % |
Coverage | 100% |
Changes | 0 |
1 | package idempotency |
||
2 | |||
3 | import "github.com/google/uuid" |
||
4 | |||
5 | type stdGenerator struct{} |
||
6 | |||
7 | // Generate encapsulates the logic to return a string representation of |
||
8 | // a unique idempotency key. |
||
9 | // |
||
10 | // A string representation of a v4 uuid for this implementation. |
||
11 | func (ikg stdGenerator) Generate() string { |
||
12 | 1 | return uuid.New().String() |
|
13 | } |
||
14 | |||
15 | // NewStdGenerator returns an standard and common way of generating |
||
16 | // idempotency unique keys. |
||
17 | func NewStdGenerator() KeyGenerator { |
||
18 | 1 | return new(stdGenerator) |
|
19 | } |
||
20 |