Compare commits
	
		
			No commits in common. "cdf12a767c444fcac59b4c985d6d6b49be7b7966" and "4b9bffb1a631c8bc8c1a5c71f9995b65c6a8f2a0" have entirely different histories.
		
	
	
		
			
				cdf12a767c
			
			...
			
				4b9bffb1a6
			
		
	
		
					 2 changed files with 2 additions and 12 deletions
				
			
		|  | @ -17,10 +17,8 @@ func NominoConfig() nomino.Config { | ||||||
| 	) | 	) | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // HandleImgUploads generates new filenames for images with a png extension. | // / HandleImgUploads generates new filenames for images with a png extension. | ||||||
| func HandleImgUploads(orig string) string { | func HandleImgUploads(orig string) string { | ||||||
| 	// Here, we use nomino.Make function to generate the filename. |  | ||||||
| 	// We use our global config, and add in a few extra Options specific to this. |  | ||||||
| 	newName, _ := nomino.Make( | 	newName, _ := nomino.Make( | ||||||
| 		NominoConfig(), | 		NominoConfig(), | ||||||
| 		nomino.WithExtension("png"), | 		nomino.WithExtension("png"), | ||||||
|  | @ -34,8 +32,6 @@ func HandleImgUploads(orig string) string { | ||||||
| // We ignore the original filename and use a timestamp for the generated part | // We ignore the original filename and use a timestamp for the generated part | ||||||
| // with a webm extension. | // with a webm extension. | ||||||
| func HandleVidUploads() string { | func HandleVidUploads() string { | ||||||
| 	// Because we're using a different Generator, we chose to use the Make method on the Generator. |  | ||||||
| 	// We add in additional Options with the `AddOptions` method on the `Config` |  | ||||||
| 	newName, _ := nomino.Timestamp(nomino.TimestampUTC()). | 	newName, _ := nomino.Timestamp(nomino.TimestampUTC()). | ||||||
| 		MakeWithConfig(NominoConfig().AddOptions( | 		MakeWithConfig(NominoConfig().AddOptions( | ||||||
| 			nomino.WithExtension("webm"), | 			nomino.WithExtension("webm"), | ||||||
|  | @ -43,7 +39,7 @@ func HandleVidUploads() string { | ||||||
| 	return newName | 	return newName | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // This example shows how to use nomino. | // Example shows how to use nomino. | ||||||
| func Example() { | func Example() { | ||||||
| 	// Pretend we have an image upload | 	// Pretend we have an image upload | ||||||
| 	filename := "George" | 	filename := "George" | ||||||
|  |  | ||||||
|  | @ -1,6 +0,0 @@ | ||||||
| // Package nomino is a utility that allows us to generate random filenames. |  | ||||||
| // |  | ||||||
| // There are two main methods of using nomino. |  | ||||||
| // 1. Using the `nomini.Make` function. |  | ||||||
| // 2. Creating a generator, and using its `Make` method. |  | ||||||
| package nomino |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue