generator

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2022 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EpochNumBase = 10
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Hash

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

Hash implements a key generator that uses the specified hash algorithm.

func NewHash

func NewHash(hasher func() hash2.Hash, defaultParts ...string) *Hash

NewHash creates a new hash key generator.

func (*Hash) Check

func (h *Hash) Check() error

Check checks if generator functional.

func (*Hash) Generate

func (h *Hash) Generate(parts ...string) (string, error)

Generate generates key from given parts or templates as parameter.

type Metadata

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

Metadata implements a key generator that uses a template engine to generate keys from give metadata.

func NewMetadata

func NewMetadata(logger log.Logger, tmpl string, data metadata.Metadata, nowFunc func() time.Time) *Metadata

NewMetadata creates a new Key Generator.

func (*Metadata) Check

func (g *Metadata) Check() error

Check checks if template is parsable.

func (*Metadata) Generate

func (g *Metadata) Generate(_ ...string) (string, error)

Generate generates key from given template as parameter or fallbacks hash.

type Static

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

func NewStatic

func NewStatic(defaultParts ...string) *Static

Hash implements a key generator form given strings.

func (*Static) Check

func (s *Static) Check() error

Check checks if generator functional.

func (*Static) Generate

func (s *Static) Generate(parts ...string) (string, error)

Generate generates key from given parts or templates as parameter.

Jump to

Keyboard shortcuts

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