eventid

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventID

type EventID struct {
	// contains filtered or unexported fields
}
var (
	ErrInvalidStringSize = errors.New("string size should be 26")
	Zero                 EventID
)

func New

func New() EventID

func NewAfterTime added in v0.34.0

func NewAfterTime(t time.Time) EventID

func NewWithTime added in v0.34.0

func NewWithTime(t time.Time) EventID

func Parse

func Parse(encoded string) (EventID, error)

func TimeOnly added in v0.16.0

func TimeOnly(t time.Time) EventID

func (EventID) Compare

func (e EventID) Compare(other EventID) int

Compare returns an integer comparing id and other lexicographically. The result will be 0 if e==other, -1 if e < other, and +1 if e > other.

func (EventID) IsZero added in v0.16.0

func (e EventID) IsZero() bool

func (EventID) MarshalJSON added in v0.16.0

func (e EventID) MarshalJSON() ([]byte, error)

func (EventID) OffsetTime added in v0.16.0

func (e EventID) OffsetTime(offset time.Duration) EventID

func (*EventID) Scan added in v0.16.0

func (e *EventID) Scan(value interface{}) error

func (EventID) String

func (e EventID) String() string

func (EventID) Time

func (e EventID) Time() time.Time

func (*EventID) UnmarshalJSON added in v0.16.0

func (e *EventID) UnmarshalJSON(data []byte) error

func (EventID) Value added in v0.16.0

func (e EventID) Value() (driver.Value, error)

type Generator added in v0.34.0

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

func NewGenerator added in v0.34.0

func NewGenerator(t time.Time) *Generator

NewGenerator generates EventIDs with time.Now(). If due to clock skews, time.Now() <= t + 1ms, then the time used will be t + 1ms.

func NewGeneratorNow added in v0.35.0

func NewGeneratorNow() *Generator

func (*Generator) NewID added in v0.34.0

func (s *Generator) NewID() EventID

Jump to

Keyboard shortcuts

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