Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var (
RegexUuid = regexp.MustCompilePOSIX(reUuidStr)
)
Functions ¶
func IsEmailLike ¶
Returns whether a subject string looks like an email
func IsUuidLike ¶
Returns whether a subject string looks like a UUID
func Uuid1OrderedChar32 ¶
func Uuid1OrderedChar32() string
Returns a new "ordered" UUID1 as 32 alphanumeric characters with no dashes -- the most efficient string representation for storage in a DB (besides storing as BINARY, which makes querying ugly and overly difficult for little benefit)
Returns a UUID type 1 value, with the more constant segments of the UUID at the start of the UUID. This allows us to have mostly monotonically increasing UUID values, which are much better for INSERT/UPDATE performance in the DB.
A UUID1 hex looks like:
'27392da28bae11e4961de06995034837'
From this, we need to take the last two segments, which represent the more constant information about the node we're on, and place those first in the new UUID's bytes. We then take the '11e4' segment, which represents the most significant bits of the timestamp part of the UUID, prefixed with a '1' for UUID type, and place that next, followed by the second segment and finally the first segment, which are the next most significant bits of the timestamp 60-bit number embedded in the UUID.
So, we convert the above hex to this instead:
'961de0699503483711e48bae27392da2'
func UuidFormatDb ¶
Given a string, removes whitespace, hyphens and lowercases the string, making it ready for insertion or querying in the DB
Types ¶
This section is empty.