identifier

package
v0.0.0-...-d386c04 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SafeUnixDiff = time.Second * 10

Functions

func AfterTime

func AfterTime(t time.Time) string

AfterTime uses SafeUnixDiff as factor to make sure we can get an id that is always greater than the given time

func BeforeTime

func BeforeTime(t time.Time) string

AfterTime uses SafeUnixDiff as factor to make sure we can get an id that is always less than the given time

func Id

func Id(ns, id string) string

func New

func New(ns string) string

New return a Sortable Unique IDentifier IMPORTANT: ksuid is replied on Unix timestamp so the datetime factor is only correct at second level IMPORTANT: that means the order of the ids with same unix timestamps are not guaranteed currently we are using KSUID (https://github.com/segmentio/ksuid) other standard we can consider is UUID v7 (https://www.ietf.org/archive/id/draft-peabody-dispatch-new-uuid-format-01.html#name-uuidv7-layout-and-bit-order)

func Ns

func Ns(id string) string

func Parse

func Parse(id string) (ns string, suid string)

func Valid

func Valid(id string) bool

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL