ray

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const RayLength = 16 + 1 + 3

Variables

View Source
var ErrInvalidRayID = errors.New("invalid ray ID")

Functions

func ToHostString

func ToHostString(s string) string

Types

type Generator

type Generator struct {
	// contains filtered or unexported fields
}

func NewGenerator

func NewGenerator(host string) (r Generator)

func (*Generator) Next

func (r *Generator) Next() string

type Host

type Host [3]byte

func ParseHost

func ParseHost(s string) (p Host)

func (Host) EqualFold

func (p Host) EqualFold(s string) bool

func (Host) MarshalText

func (p Host) MarshalText() ([]byte, error)

func (Host) Normal

func (p Host) Normal() Host

func (Host) String

func (p Host) String() string

func (*Host) UnmarshalText

func (p *Host) UnmarshalText(text []byte) error

type ID

type ID struct {
	ID   snowflake.ID
	Host Host
}

func Parse

func Parse(s string) (r ID, e error)

func (ID) MarshalText

func (r ID) MarshalText() (text []byte, err error)

func (ID) String

func (r ID) String() string

func (ID) Timestamp

func (r ID) Timestamp() time.Time

func (ID) ToArray added in v0.2.3

func (r ID) ToArray() (text [RayLength]byte)

func (*ID) UnmarshalText

func (r *ID) UnmarshalText(text []byte) error

Jump to

Keyboard shortcuts

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