Documentation ¶
Overview ¶
id - AC style unique ids
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckAddr ¶
func CheckAddr() uint32
CheckAddr returns the default 32bit host id (IP address), for examination
func Unique ¶
func Unique(opts ...optFunc) string
Unique() returns a unique id ids are url safe, non-sortable, and appear "random-looking" with no visible pattern eg: rk5zzm2zkmt5djecxwj4 if passed the option WithUpperCase(), the id will be shorter and contain upper + lower case letters eg: KaGFYkoJhPs3eNx9 if passed WithLength(n), the id will be no shorter than the requested length
func WithHost ¶
WithHost specifies a value unique to this server by default the host's IP address is used
func WithHost16 ¶
WithHost16 specifies a value unique to this server by using a 16bit value, additional bits are available for the time field and more ids can be generated without the length growing
func WithHost16Default ¶
func WithHost16Default() func(*Gen)
WithHost16Default uses the lower 16bits of host's IP see also: WithHost16()
func WithLength ¶
WithLength causes the unique id to be at least the requested length by adding randomly generated data if needed
func WithPid ¶
WithPid specifies a value unique to this process by default the lower 16bits of the process-id are used
func WithUpperCase ¶
func WithUpperCase() func(*Gen)
WithUpperCase causes the unique id to use uppercase and some (url safe) punctuation in addition to the default of lowercase + numbers