raid

package module
v0.0.0-...-07a22ce Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidId = errors.New("raid: invalid raid id")
)
View Source
var (
	NilRaid = Raid{}
)

Functions

This section is empty.

Types

type Raid

type Raid [20]byte

Raid is 20 byte identifier. 2 byte prefix -- enough for 3 characters in base32. 4 byte unix seconds timestamp -- make id became sortable. 2 byte message -- 16 bit message, masked with 15th and 16th byte. 12 byte randoms -- 96 bit randoms, make id un guessable

func NewRaid

func NewRaid() Raid

func RaidFromString

func RaidFromString(str string) (Raid, error)

func (Raid) Bytes

func (rr Raid) Bytes() []byte

func (Raid) Compare

func (rr Raid) Compare(r Raid) int

func (Raid) Encode

func (rr Raid) Encode(dst []byte)

func (Raid) IsNil

func (rr Raid) IsNil() bool

func (Raid) IsZero

func (rr Raid) IsZero() bool

func (Raid) Less

func (rr Raid) Less(r Raid) bool

func (Raid) MarshalJSON

func (rr Raid) MarshalJSON() ([]byte, error)

func (Raid) MarshalText

func (rr Raid) MarshalText() ([]byte, error)

func (Raid) Message

func (rr Raid) Message() uint16

func (Raid) Prefix

func (rr Raid) Prefix() string

func (*Raid) Scan

func (rr *Raid) Scan(value any) error

func (Raid) String

func (rr Raid) String() string

func (Raid) Time

func (rr Raid) Time() time.Time

func (*Raid) UnmarshalJSON

func (rr *Raid) UnmarshalJSON(b []byte) error

func (*Raid) UnmarshalText

func (rr *Raid) UnmarshalText(b []byte) error

func (Raid) Value

func (rr Raid) Value() (driver.Value, error)

func (Raid) WithMessage

func (rr Raid) WithMessage(msg uint16) Raid

func (Raid) WithPrefix

func (rr Raid) WithPrefix(prefix string) Raid

func (Raid) WithPrefixByte

func (rr Raid) WithPrefixByte(prefix []byte) Raid

func (Raid) WithRandom

func (rr Raid) WithRandom() Raid

func (Raid) WithTimestamp

func (rr Raid) WithTimestamp(t time.Time) Raid

func (Raid) WithTimestampNow

func (rr Raid) WithTimestampNow() Raid

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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