uuid

package module
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: MIT Imports: 12 Imported by: 0

README

Go Reference

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Time

func Time(ms uint64) time.Time

func Timestamp

func Timestamp(t time.Time) uint64

Types

type UUID

type UUID string
var (
	Nil UUID
)

func FromHashLike

func FromHashLike(str string) (UUID, error)

FromHashLike parses uuid in hash format, eg: afe406938f63476685f1250a427f1db5

func FromString

func FromString(str string) (UUID, error)

FromString parses uuid in canonical format, eg: afe40693-8f63-4766-85f1-250a427f1db5

func NewTime

func NewTime(t time.Time) UUID

func NewV4

func NewV4() UUID

func (UUID) HashLike

func (u UUID) HashLike() string

HashLike returns the uuid without dashes, eg: afe406938f63476685f1250a427f1db5

func (UUID) MarshalBinary

func (u UUID) MarshalBinary() (data []byte, err error)

func (UUID) MarshalJSON

func (u UUID) MarshalJSON() ([]byte, error)

func (UUID) MarshalText

func (u UUID) MarshalText() ([]byte, error)

func (UUID) Next

func (u UUID) Next() (UUID, error)

Next generates a new uuid from the current one. The uuid returned is consistent, meaning calling Next() on a given uuid will always return the same value.

func (*UUID) Scan

func (u *UUID) Scan(src interface{}) error

func (UUID) String

func (u UUID) String() string

func (UUID) TimeUUIDToTime

func (u UUID) TimeUUIDToTime() (time.Time, error)

TimeUUIDToTime converts UUID into UTC time. @warning - Handle with care. If you use it for single UUID you will receive random/invalid timestamp.

func (*UUID) UnmarshalBinary

func (u *UUID) UnmarshalBinary(data []byte) error

func (*UUID) UnmarshalJSON

func (u *UUID) UnmarshalJSON(b []byte) error

func (*UUID) UnmarshalText

func (u *UUID) UnmarshalText(text []byte) error

func (UUID) Value

func (u UUID) Value() (driver.Value, error)

func (UUID) XOR

func (u UUID) XOR(v UUID) (UUID, error)

Jump to

Keyboard shortcuts

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