📝 Redo ts examples to use gen.Make

This commit is contained in:
Dan Jones 2025-03-16 15:56:31 -05:00
commit d7b14f804c

View file

@ -9,8 +9,7 @@ import (
func ExampleTimestamp() { func ExampleTimestamp() {
gen := nomino.Timestamp() gen := nomino.Timestamp()
conf := nomino.NewConfig(nomino.WithGenerator(gen)) s, _ := gen.Make()
s, _ := nomino.Make(conf)
fmt.Println(s) fmt.Println(s)
} }
@ -18,8 +17,7 @@ func ExampleTimestampTime() {
tz, _ := time.LoadLocation("America/New_York") tz, _ := time.LoadLocation("America/New_York")
ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz)
gen := nomino.Timestamp(nomino.TimestampTime(ts)) gen := nomino.Timestamp(nomino.TimestampTime(ts))
conf := nomino.NewConfig(nomino.WithGenerator(gen)) s, _ := gen.Make()
s, _ := nomino.Make(conf)
fmt.Println(s) fmt.Println(s)
// Output: 2009-01-20T12-05-00-0500.txt // Output: 2009-01-20T12-05-00-0500.txt
} }
@ -28,8 +26,7 @@ func ExampleTimestampFormat() {
tz, _ := time.LoadLocation("America/New_York") tz, _ := time.LoadLocation("America/New_York")
ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz)
gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampFormat("2006#01#02<>15|04|05-0700")) gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampFormat("2006#01#02<>15|04|05-0700"))
conf := nomino.NewConfig(nomino.WithGenerator(gen)) s, _ := gen.Make()
s, _ := nomino.Make(conf)
fmt.Println(s) fmt.Println(s)
// Output: 2009#01#20<>12|05|00-0500.txt // Output: 2009#01#20<>12|05|00-0500.txt
} }
@ -38,8 +35,7 @@ func ExampleTimestampUTC() {
tz, _ := time.LoadLocation("America/New_York") tz, _ := time.LoadLocation("America/New_York")
ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz)
gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampUTC()) gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampUTC())
conf := nomino.NewConfig(nomino.WithGenerator(gen)) s, _ := gen.Make()
s, _ := nomino.Make(conf)
fmt.Println(s) fmt.Println(s)
// Output: 2009-01-20T17-05-00.txt // Output: 2009-01-20T17-05-00.txt
} }