✅ Examples for everything
This commit is contained in:
parent
bd448eb5db
commit
9402d80704
4 changed files with 124 additions and 51 deletions
|
|
@ -7,7 +7,14 @@ import (
|
|||
"codeberg.org/danjones000/nomino"
|
||||
)
|
||||
|
||||
func ExampleTimestamp_withTime() {
|
||||
func ExampleTimestamp() {
|
||||
gen := nomino.Timestamp()
|
||||
conf := nomino.NewConfig(nomino.WithGenerator(gen))
|
||||
s, _ := nomino.Make(conf)
|
||||
fmt.Println(s)
|
||||
}
|
||||
|
||||
func ExampleTimestampTime() {
|
||||
tz, _ := time.LoadLocation("America/New_York")
|
||||
ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz)
|
||||
gen := nomino.Timestamp(nomino.TimestampTime(ts))
|
||||
|
|
@ -17,7 +24,7 @@ func ExampleTimestamp_withTime() {
|
|||
// Output: 2009-01-20T12-05-00-0500.txt
|
||||
}
|
||||
|
||||
func ExampleTimestamp_withFormat() {
|
||||
func ExampleTimestampFormat() {
|
||||
tz, _ := time.LoadLocation("America/New_York")
|
||||
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"))
|
||||
|
|
@ -27,7 +34,7 @@ func ExampleTimestamp_withFormat() {
|
|||
// Output: 2009#01#20<>12|05|00-0500.txt
|
||||
}
|
||||
|
||||
func ExampleTimestamp_withUTC() {
|
||||
func ExampleTimestampUTC() {
|
||||
tz, _ := time.LoadLocation("America/New_York")
|
||||
ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz)
|
||||
gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampUTC())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue