✨ Add Random Generator
This commit is contained in:
parent
5c1132e414
commit
1677a692d1
8 changed files with 142 additions and 53 deletions
|
|
@ -1,10 +1,6 @@
|
|||
package nomino
|
||||
|
||||
import (
|
||||
"errors"
|
||||
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
import "errors"
|
||||
|
||||
// Generator is a function that returns the "random" portion of the returned filename.
|
||||
// Technically, it doesn't necessarily need to be random, and could be based on time, or a counter,
|
||||
|
|
@ -43,16 +39,3 @@ func MultiGeneratorInOrder(gens ...Generator) Generator {
|
|||
return st, err
|
||||
}
|
||||
}
|
||||
|
||||
func uuidGen(*Config) (string, error) {
|
||||
u, err := uuid.NewRandom()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return u.String(), nil
|
||||
}
|
||||
|
||||
// UUID generates a UUIDv4.
|
||||
func UUID() Generator {
|
||||
return uuidGen
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue