| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | package nomino_test | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | import ( | 
					
						
							|  |  |  | 	"fmt" | 
					
						
							|  |  |  | 	"time" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	"codeberg.org/danjones000/nomino" | 
					
						
							|  |  |  | ) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-14 21:22:29 -05:00
										 |  |  | func ExampleTimestamp() { | 
					
						
							|  |  |  | 	gen := nomino.Timestamp() | 
					
						
							|  |  |  | 	conf := nomino.NewConfig(nomino.WithGenerator(gen)) | 
					
						
							|  |  |  | 	s, _ := nomino.Make(conf) | 
					
						
							|  |  |  | 	fmt.Println(s) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | func ExampleTimestampTime() { | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	tz, _ := time.LoadLocation("America/New_York") | 
					
						
							|  |  |  | 	ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) | 
					
						
							| 
									
										
										
										
											2025-03-14 18:09:07 -05:00
										 |  |  | 	gen := nomino.Timestamp(nomino.TimestampTime(ts)) | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	conf := nomino.NewConfig(nomino.WithGenerator(gen)) | 
					
						
							|  |  |  | 	s, _ := nomino.Make(conf) | 
					
						
							|  |  |  | 	fmt.Println(s) | 
					
						
							|  |  |  | 	// Output: 2009-01-20T12-05-00-0500.txt | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-14 21:22:29 -05:00
										 |  |  | func ExampleTimestampFormat() { | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	tz, _ := time.LoadLocation("America/New_York") | 
					
						
							|  |  |  | 	ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) | 
					
						
							| 
									
										
										
										
											2025-03-14 18:09:07 -05:00
										 |  |  | 	gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampFormat("2006#01#02<>15|04|05-0700")) | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	conf := nomino.NewConfig(nomino.WithGenerator(gen)) | 
					
						
							|  |  |  | 	s, _ := nomino.Make(conf) | 
					
						
							|  |  |  | 	fmt.Println(s) | 
					
						
							|  |  |  | 	// Output: 2009#01#20<>12|05|00-0500.txt | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2025-03-14 21:22:29 -05:00
										 |  |  | func ExampleTimestampUTC() { | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	tz, _ := time.LoadLocation("America/New_York") | 
					
						
							|  |  |  | 	ts := time.Date(2009, time.January, 20, 12, 5, 0, 0, tz) | 
					
						
							| 
									
										
										
										
											2025-03-14 18:09:07 -05:00
										 |  |  | 	gen := nomino.Timestamp(nomino.TimestampTime(ts), nomino.TimestampUTC()) | 
					
						
							| 
									
										
										
										
											2025-03-14 17:39:42 -05:00
										 |  |  | 	conf := nomino.NewConfig(nomino.WithGenerator(gen)) | 
					
						
							|  |  |  | 	s, _ := nomino.Make(conf) | 
					
						
							|  |  |  | 	fmt.Println(s) | 
					
						
							|  |  |  | 	// Output: 2009-01-20T17-05-00.txt | 
					
						
							|  |  |  | } |