Documentation ¶
Index ¶
- Variables
- func FormatUUID(part string) (string, error)
- func GenerateHexspeakUUID(i int) (string, error)
- func GenerateLenUUID(i int) (string, error)
- func GenerateRandomUUID(length int) (string, error)
- func IsUUID(input string) error
- func PrefixUUID(prefix string, uuid string) (string, error)
- func SuffixUUID(suffix string, uuid string) (string, error)
- type AnonUUID
Examples ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// UUIDRegex is the regex used to find UUIDs in texts
UUIDRegex = "[a-z0-9]{8}-[a-z0-9]{4}-[1-5][a-z0-9]{3}-[a-z0-9]{4}-[a-z0-9]{12}"
)
Functions ¶
func FormatUUID ¶
FormatUUID takes a string in input and return an UUID formatted string by repeating the string and placing dashes if necessary
func GenerateHexspeakUUID ¶
GenerateHexspeakUUID returns an UUID formatted string containing hexspeak words
func GenerateLenUUID ¶
GenerateLenUUID returns an UUID formatted string based on an index number
func GenerateRandomUUID ¶
GenerateRandomUUID returns an UUID based on random strings
func PrefixUUID ¶
PrefixUUID returns a prefixed UUID
Types ¶
type AnonUUID ¶
type AnonUUID struct { // Hexspeak flag will generate hexspeak style fake UUIDs Hexspeak bool // Random flag will generate random fake UUIDs Random bool // Prefix will be the beginning of all the generated UUIDs Prefix string // Suffix will be the end of all the generated UUIDs Suffix string // AllowNonUUIDInput tells FakeUUID to accept non UUID input string AllowNonUUIDInput bool // KeepBeginning tells FakeUUID to let the beginning of the UUID as it is KeepBeginning bool // KeepEnd tells FakeUUID to let the last part of the UUID as it is KeepEnd bool // contains filtered or unexported fields }
AnonUUID is the main structure, it contains the cache map and helpers
func (*AnonUUID) FakeUUID ¶
FakeUUID takes a word (real UUID or standard string) and returns its corresponding (mapped) fakeUUID
Example ¶
anonuuid := New() fmt.Println(anonuuid.FakeUUID("15573749-c89d-41dd-a655-16e79bed52e0")) fmt.Println(anonuuid.FakeUUID("15573749-c89d-41dd-a655-16e79bed52e0")) fmt.Println(anonuuid.FakeUUID("c245c3cb-3336-4567-ada1-70cb1fe4eefe")) fmt.Println(anonuuid.FakeUUID("c245c3cb-3336-4567-ada1-70cb1fe4eefe")) fmt.Println(anonuuid.FakeUUID("15573749-c89d-41dd-a655-16e79bed52e0")) fmt.Println(anonuuid.FakeUUID("fe1e54e8-d69d-4f7c-a9f1-42069e03da31"))
Output: 00000000-0000-1000-0000-000000000000 00000000-0000-1000-0000-000000000000 11111111-1111-1111-1111-111111111111 11111111-1111-1111-1111-111111111111 00000000-0000-1000-0000-000000000000 22222222-2222-1222-2222-222222222222
func (*AnonUUID) Sanitize ¶
Sanitize takes a string as input and return sanitized string
Example ¶
anonuuid := New() fmt.Println(anonuuid.Sanitize(exampleInput))
Output: VOLUMES_0_SERVER_ID=00000000-0000-1000-0000-000000000000 VOLUMES_0_SERVER_NAME=hello VOLUMES_0_ID=11111111-1111-1111-1111-111111111111 VOLUMES_0_SIZE=50000000000 ORGANIZATION=22222222-2222-1222-2222-222222222222 TEST=00000000-0000-1000-0000-000000000000
Click to show internal directories.
Click to hide internal directories.