From c32a15f4a1bbd48ded03a737dc198bca91d50460 Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sun, 23 Mar 2025 10:52:54 -0500 Subject: [PATCH 1/2] =?UTF-8?q?=F0=9F=92=A1=20Add=20some=20helpful=20comme?= =?UTF-8?q?nts=20in=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples_test.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples_test.go b/examples_test.go index ee5f8e0..c929985 100644 --- a/examples_test.go +++ b/examples_test.go @@ -17,8 +17,10 @@ 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 { + // 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( NominoConfig(), nomino.WithExtension("png"), @@ -32,6 +34,8 @@ func HandleImgUploads(orig string) string { // We ignore the original filename and use a timestamp for the generated part // with a webm extension. 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()). MakeWithConfig(NominoConfig().AddOptions( nomino.WithExtension("webm"), @@ -39,7 +43,7 @@ func HandleVidUploads() string { return newName } -// Example shows how to use nomino. +// This example shows how to use nomino. func Example() { // Pretend we have an image upload filename := "George" From ac3d1a556575e068e859efb3f600f6bd963c71cb Mon Sep 17 00:00:00 2001 From: Dan Jones Date: Sun, 23 Mar 2025 10:53:49 -0500 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=92=A1=20Add=20package=20level=20doc?= =?UTF-8?q?=20comment?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nomino.go | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 nomino.go diff --git a/nomino.go b/nomino.go new file mode 100644 index 0000000..8310519 --- /dev/null +++ b/nomino.go @@ -0,0 +1,6 @@ +// 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