ksuid

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2024 License: ISC Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const Epoch = 1_400_000_000

Variables

View Source
var ErrInvalidFormat = errors.New("invalid format")
View Source
var Zero = KSUID{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}

Functions

func Base62Decode

func Base62Decode(s string) ([]byte, error)

func Base62Encode

func Base62Encode(data []byte) string

Types

type KSUID

type KSUID [20]byte

func Generate

func Generate() KSUID

func GenerateWithTime

func GenerateWithTime(t time.Time) KSUID

func GenerateWithTimestamp

func GenerateWithTimestamp(timestamp uint32) KSUID

func (KSUID) GoString

func (id KSUID) GoString() string

func (KSUID) IsZero

func (id KSUID) IsZero() bool

func (KSUID) MarshalJSON

func (id KSUID) MarshalJSON() ([]byte, error)

func (*KSUID) Parse

func (id *KSUID) Parse(s string) error

func (*KSUID) Scan

func (id *KSUID) Scan(src interface{}) error

sql.Scanner interface

func (KSUID) String

func (id KSUID) String() string

func (KSUID) Time

func (id KSUID) Time() time.Time

func (KSUID) Timestamp

func (id KSUID) Timestamp() uint32

func (*KSUID) UnmarshalJSON

func (id *KSUID) UnmarshalJSON(data []byte) error

func (KSUID) Value

func (id KSUID) Value() (driver.Value, error)

sql/driver.Valuer interface

func (*KSUID) ValueOrZero

func (id *KSUID) ValueOrZero() KSUID

type KSUIDs

type KSUIDs []KSUID

func (KSUIDs) MarshalJSON

func (ids KSUIDs) MarshalJSON() ([]byte, error)

func (*KSUIDs) Parse

func (pids *KSUIDs) Parse(ss []string) error

func (*KSUIDs) Scan

func (ids *KSUIDs) Scan(src interface{}) error

sql.Scanner interface

func (KSUIDs) Strings

func (ids KSUIDs) Strings() []string

func (*KSUIDs) UnmarshalJSON

func (ids *KSUIDs) UnmarshalJSON(data []byte) error

func (KSUIDs) Value

func (id KSUIDs) Value() (driver.Value, error)

sql/driver.Valuer interface

Jump to

Keyboard shortcuts

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