id

package
v1.385.0 Latest Latest
Warning

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

Go to latest
Published: Jan 24, 2025 License: MIT Imports: 9 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Default = &UUID{}

Default generator.

Module for fx.

Functions

func IsEnabled

func IsEnabled(config *Config) bool

IsEnabled the config.

Types

type Config

type Config struct {
	Kind string `yaml:"kind,omitempty" json:"kind,omitempty" toml:"kind,omitempty"`
}

Config for id.

type Generator

type Generator interface {
	// Generate an identifier.
	Generate() string
}

Generator to generate an identifier.

func NewGenerator

func NewGenerator(config *Config) Generator

NewGenerator from config.

type KSUID

type KSUID struct{}

KSUID generator.

func (*KSUID) Generate

func (k *KSUID) Generate() string

Generate a KSUID.

type NanoID

type NanoID struct{}

NanoID generator.

func (*NanoID) Generate

func (n *NanoID) Generate() string

Generate a NanoID.

type ULID

type ULID struct{}

ULID generator.

func (*ULID) Generate

func (k *ULID) Generate() string

Generate a ULID.

type UUID

type UUID struct{}

UUID generator.

func (*UUID) Generate

func (g *UUID) Generate() string

Generate a UUID.

type XID

type XID struct{}

XID generator.

func (*XID) Generate

func (x *XID) Generate() string

Generate an XID.

Jump to

Keyboard shortcuts

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