sequence

package
v0.38.0 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Module(
	"vef:sequence",
	fx.Provide(
		fx.Annotate(
			sequence.NewMemoryStore,
			fx.As(fx.Self()),
			fx.As(new(sequence.Store)),
		),
		NewGenerator,
	),
	fx.Invoke(initStore),
)

Module provides the sequence generation functionality for the VEF framework.

The in-memory store backs the Generator by default and is also exposed as its concrete *sequence.MemoryStore, so applications can inject it and seed rules via MemoryStore.Register during their own start-up hook.

Applications can replace the backing store with a persistent or distributed one (e.g. sequence.NewDBStore or sequence.NewRedisStore) by decorating sequence.Store with vef.Decorate. When the active store implements contract.Initializer (as *sequence.DBStore does), initStore runs Init at start-up.

Functions

func NewGenerator

func NewGenerator(store sequence.Store) sequence.Generator

NewGenerator creates a new sequence generator.

Types

type Engine

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

Engine implements sequence.Generator using a pluggable Store backend.

func (*Engine) Generate

func (e *Engine) Generate(ctx context.Context, key string) (string, error)

func (*Engine) GenerateN

func (e *Engine) GenerateN(ctx context.Context, key string, count int) ([]string, error)

Jump to

Keyboard shortcuts

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