Documentation
¶
Index ¶
- func HumanUid() string
- func MicroUid() string
- func NanoUid() string
- func SecUid() string
- func Timestamp() string
- func TimestampMicro() string
- func TimestampNano() string
- func Uuid() string
- func UuidFormatted() string
- func UuidV1() string
- func UuidV1Formatted() string
- func UuidV3(namespace string, data []byte) (string, error)
- func UuidV3Formatted(namespace string, data []byte) (string, error)
- func UuidV4() string
- func UuidV4Formatted() string
- func UuidV5(namespace string, data []byte) (string, error)
- func UuidV5Formatted(namespace string, data []byte) (string, error)
- func UuidV6() string
- func UuidV6Formatted() string
- func UuidV7() string
- func UuidV7Formatted() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HumanUid ¶
func HumanUid() string
HumanUid generates a 32-character time-prefixed unique ID.
Format (conceptual): YYYYMMDDHHMMSSMMMMMMM + random suffix, truncated to 32.
Example: 20250831151133000012345678901234 (length: 32)
Parameters: - None
Returns: - A 32-character uppercase numeric string suitable for human-readable IDs
func MicroUid ¶
func MicroUid() string
MicroUid generates a 20-character time-prefixed unique ID.
Format (conceptual): YYYYMMDDHHMMSSMMMMMMM + random suffix, truncated to 20.
Example: 20250831151133000012 (length: 20)
Parameters: - None
Returns: - A 20-character numeric string
func NanoUid ¶
func NanoUid() string
NanoUid generates a 23-character time-prefixed unique ID.
Format (conceptual): YYYYMMDDHHMMSSMMMMMMM + random suffix, truncated to 23.
Example: 20250831151133000012345 (length: 23)
Parameters: - None
Returns: - A 23-character numeric string
func SecUid ¶
func SecUid() string
SecUid generates a 14-character time-based ID.
Format: YYYYMMDDHHMMSS
Example: 20250831151133 (length: 14)
Parameters: - None
Returns: - A 14-character numeric string representing UTC date/time to the second
func Timestamp ¶
func Timestamp() string
Timestamp returns the current Unix timestamp in seconds as a string.
Example: 1725111153 (length: 10)
Parameters: - None
Returns: - Unix timestamp in seconds (base-10 string)
func TimestampMicro ¶
func TimestampMicro() string
TimestampMicro returns the current Unix timestamp in microseconds as a string.
Example: 1725111153123456 (length: 16)
Parameters: - None
Returns: - Unix timestamp in microseconds (base-10 string)
func TimestampNano ¶
func TimestampNano() string
TimestampNano returns the current Unix timestamp in nanoseconds as a string.
Example: 1725111153123456789 (length: 19)
Parameters: - None
Returns: - Unix timestamp in nanoseconds (base-10 string)
func Uuid ¶
func Uuid() string
Uuid returns a random UUID (version 4) without hyphens.
Example: 550e8400e29b41d4a716446655440000 (length: 32)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
Parameters: - None
Returns: - A random UUID (version 4) without hyphens
func UuidFormatted ¶
func UuidFormatted() string
UuidFormatted returns a random UUID (version 4) string with hyphens.
Example: 550e8400-e29b-41d4-a716-446655440000 (length: 36)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
Parameters: - None
Returns: - A random UUID (version 4) with hyphens
func UuidV1 ¶
func UuidV1() string
UuidV1 returns a version 1 (time-based) UUID without hyphens.
Example: 6ba7b8109dad11d180b400c04fd430c8 (length: 32)
Parameters: - None
Returns: - A UUID v1 (time-based) without hyphens
func UuidV1Formatted ¶
func UuidV1Formatted() string
UuidV1Formatted returns a version 1 (time-based) UUID with hyphens.
Example: 6ba7b810-9dad-11d1-80b4-00c04fd430c8 (length: 36)
Parameters: - None
Returns: - A UUID v1 (time-based) with hyphens
func UuidV3 ¶
UuidV3 returns a version 3 (MD5 name-based) UUID without hyphens. Provide a 16-byte namespace UUID and arbitrary data.
Example (no hyphens): 3d813cbb47fb32ba91df831e1593ac29 (length: 32)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
Parameters: - namespace: a 16-byte UUID (as bytes) used as the namespace - data: the name bytes to hash
Returns: - The UUID v3 as a 32-character string without hyphens, or an error
func UuidV3Formatted ¶
UuidV3Formatted returns a version 3 (MD5 name-based) UUID with hyphens. Provide a 16-byte namespace UUID and arbitrary data.
Example: 3d813cbb-47fb-32ba-91df-831e1593ac29 (length: 36)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
Parameters: - namespace: a 16-byte UUID (as bytes) used as the namespace - data: the name bytes to hash
Returns: - The UUID v3 as a 36-character string with hyphens, or an error
func UuidV4 ¶
func UuidV4() string
UuidV4 returns a random UUID (version 4) without hyphens.
Example: 550e8400e29b41d4a716446655440000 (length: 32)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
Parameters: - None
Returns: - A random UUID (version 4) without hyphens
func UuidV4Formatted ¶
func UuidV4Formatted() string
UuidV4Formatted returns a random UUID (version 4) with hyphens.
Example: 550e8400-e29b-41d4-a716-446655440000 (length: 36)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random)
Parameters: - None
Returns: - A random UUID (version 4) with hyphens
func UuidV5 ¶
UuidV5 returns a version 5 (SHA-1 name-based) UUID without hyphens. Provide a 16-byte namespace UUID and arbitrary data.
Example (no hyphens): 21f7f8de80515b8986800195ef798b6a (length: 32)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
Parameters: - namespace: a 16-byte UUID (as bytes) used as the namespace - data: the name bytes to hash
Returns: - The UUID v5 as a 32-character string without hyphens, or an error
func UuidV5Formatted ¶
UuidV5Formatted returns a version 5 (SHA-1 name-based) UUID with hyphens. Provide a 16-byte namespace UUID and arbitrary data.
Example: 21f7f8de-8051-5b89-8680-0195ef798b6a (length: 36)
https://en.wikipedia.org/wiki/Universally_unique_identifier#Versions_3_and_5_(namespace_name-based)
Parameters: - namespace: a 16-byte UUID (as bytes) used as the namespace - data: the name bytes to hash
Returns: - The UUID v5 as a 36-character string with hyphens, or an error
func UuidV6 ¶
func UuidV6() string
UuidV6 returns a version 6 (time-ordered) UUID without hyphens.
Example: 1ed0c9e48f7b6b2c9c3b6a6c7a9d5e12 (length: 32)
Parameters: - None
Returns: - A UUID v6 (time-ordered) without hyphens
func UuidV6Formatted ¶
func UuidV6Formatted() string
UuidV6Formatted returns a version 6 (time-ordered) UUID with hyphens.
Example: 1ed0c9e4-8f7b-6b2c-9c3b-6a6c7a9d5e12 (length: 36)
Parameters: - None
Returns: - A UUID v6 (time-ordered) with hyphens
func UuidV7 ¶
func UuidV7() string
UuidV7 returns a version 7 (Unix time-based) UUID without hyphens.
Example: 01890f5f3d9c7a0e8a7b6c5d4e3f2a10 (length: 32)
Draft: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_7_(timestamp_and_random)
Parameters: - None
Returns: - A UUID v7 (Unix time-based) without hyphens
func UuidV7Formatted ¶
func UuidV7Formatted() string
UuidV7Formatted returns a version 7 (Unix time-based) UUID with hyphens.
Example: 01890f5f-3d9c-7a0e-8a7b-6c5d4e3f2a10 (length: 36)
Draft: https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_7_(timestamp_and_random)
Parameters: - None
Returns: - A UUID v7 (Unix time-based) with hyphens
Types ¶
This section is empty.