2025-03-11 16:54:03 -05:00
|
|
|
package nomino
|
|
|
|
|
|
|
|
|
|
import "fmt"
|
|
|
|
|
|
|
|
|
|
func ExampleWithGenerator_custom_generator() {
|
2025-03-13 15:36:30 -05:00
|
|
|
gen := func(*Config) (string, error) {
|
2025-03-11 16:54:03 -05:00
|
|
|
return "hello", nil
|
|
|
|
|
}
|
|
|
|
|
option := WithGenerator(gen)
|
|
|
|
|
|
|
|
|
|
str, _ := Make(NewConfig(option))
|
|
|
|
|
fmt.Println(str)
|
|
|
|
|
|
|
|
|
|
str, _ = Make(NewConfig(option, WithoutExtension()))
|
|
|
|
|
fmt.Println(str)
|
|
|
|
|
|
|
|
|
|
// Output:
|
|
|
|
|
// hello.txt
|
|
|
|
|
// hello
|
|
|
|
|
}
|