You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fx.Decorate(fxtestuuid.NewFxTestUuidGeneratorFactory), // override the module with the TestUuidGeneratorFactory
109
-
fx.Invoke(func(generator *uuid.UuidGenerator) { // invoke the generator
112
+
fx.Invoke(func(generator uuid.UuidGenerator) {// invoke the generator
110
113
fmt.Printf("uuid: %s", generator.Generate()) // uuid: some deterministic value
111
114
}),
112
115
).Run()
113
116
}
114
117
```
115
118
116
-
### Override
119
+
#### UUID V7
120
+
121
+
##### Usage
122
+
123
+
This module provides a [UuidV7Generator](https://github.com/ankorstore/yokai/blob/main/generate/uuidv7/generator.go), made available into the Fx container.
This module provides the possibility to make your [UuidV7Generator](https://github.com/ankorstore/yokai/blob/main/generate/uuidv7/generator.go) generate deterministic values, for testing purposes.
150
+
151
+
You need to:
117
152
118
-
By default, the `uuid.UuidGenerator` is created by the [DefaultUuidGeneratorFactory](https://github.com/ankorstore/yokai/blob/main/generate/uuid/factory.go).
153
+
- first provide into the Fx container the deterministic value to be used for generation, annotated with `name:"generate-test-uuid-v7-value"`
154
+
- then decorate into the Fx container the `UuidV7GeneratorFactory` with the provided [TestUuidGeneratorV7Factory](fxgeneratetest/uuidv7/factory.go)
0 commit comments