id

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenID

func GenID(raw string) string

GenID generates an ID according to the raw material.

Types

type ID added in v0.2.0

type ID uint64

ID is the type of the id field used for any entities

func (ID) MarshalJSON added in v0.2.0

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

MarshalJSON is the way to encode ID to JSON string.

func (ID) String added in v0.2.0

func (id ID) String() string

String indicates how to convert ID to a string.

func (*ID) UnmarshalJSON added in v0.2.0

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

UnmarshalJSON is the way to decode ID from JSON string.

type IDGenerator added in v0.2.0

type IDGenerator interface {
	// NextID generates an ID.
	NextID() ID
}

IDGenerator is an interface for generating IDs.

func NewIDGenerator added in v0.2.0

func NewIDGenerator() (IDGenerator, error)

NewIDGenerator returns an IDGenerator object.

Jump to

Keyboard shortcuts

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