id

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 9 Imported by: 0

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

type ID uint64

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

func (ID) MarshalJSON

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

MarshalJSON is the way to encode ID to JSON string.

func (ID) String

func (id ID) String() string

String indicates how to convert ID to a string.

func (*ID) UnmarshalJSON

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

UnmarshalJSON is the way to decode ID from JSON string.

type IDGenerator

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

IDGenerator is an interface for generating IDs.

func NewIDGenerator

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