generator

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2022 License: Unlicense Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("generator not found")

ErrNotFound for generator.

Functions

This section is empty.

Types

type Application

type Application struct {
	Name      string `yaml:"name"`
	Kind      string `yaml:"kind"`
	Prefix    string `yaml:"prefix"`
	Suffix    string `yaml:"suffix"`
	Separator string `yaml:"separator"`
}

Application fto generate identifiers.

func (*Application) ID

func (a *Application) ID(id string) string

ID for the application.

type Config

type Config struct {
	Applications []Application `yaml:"applications"`
}

Config for generator.

func (*Config) Application

func (c *Config) Application(name string) *Application

Application by name.

type Generator

type Generator interface {
	// Generate an identifier.
	Generate(ctx context.Context) (string, error)
}

Generator to generate an identifier.

func NewGenerator

func NewGenerator(kind string) (Generator, error)

NewGenerator from kind.

type KSUID added in v1.3.0

type KSUID struct{}

KSUID generator.

func (*KSUID) Generate added in v1.3.0

func (k *KSUID) Generate(ctx context.Context) (string, error)

Generate a KSUID.

type UUID

type UUID struct{}

UUID generator.

func (*UUID) Generate

func (g *UUID) Generate(ctx context.Context) (string, error)

Generate a UUID.

Jump to

Keyboard shortcuts

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