✅ Examples for everything
This commit is contained in:
parent
bd448eb5db
commit
9402d80704
4 changed files with 124 additions and 51 deletions
|
|
@ -25,3 +25,41 @@ func ExampleWithGenerator_customGenerator() {
|
|||
// hello.txt
|
||||
// hello
|
||||
}
|
||||
|
||||
func ExampleMultiGeneratorInOrder() {
|
||||
gen1 := func(*nomino.Config) (string, error) {
|
||||
return "hello", nil
|
||||
}
|
||||
gen2 := func(*nomino.Config) (string, error) {
|
||||
return "goodbye", nil
|
||||
}
|
||||
gen := nomino.MultiGeneratorInOrder(gen1, gen2)
|
||||
option := nomino.WithGenerator(gen)
|
||||
|
||||
str, _ := nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
|
||||
str, _ = nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
|
||||
str, _ = nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
|
||||
// Output:
|
||||
// hello.txt
|
||||
// goodbye.txt
|
||||
// hello.txt
|
||||
}
|
||||
|
||||
func ExampleUUID() {
|
||||
option := nomino.WithGenerator(nomino.UUID())
|
||||
|
||||
str, _ := nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
|
||||
str, _ = nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
|
||||
str, _ = nomino.Make(nomino.NewConfig(option))
|
||||
fmt.Println(str)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue