nameutil

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2020 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

The package nameutil contains util structures for generating names. E.g. chart release names.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	Generate(prefix string) (generated string, err error)
}

Generator is the interface that wraps the basic Generate method.

type NameGenerator

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

NameGenerator satisfies the Generator interface for generating names.

func NewDefaultNameGenerator

func NewDefaultNameGenerator() *NameGenerator

NewDefaultNameGenerator creates a new NameGenerator with the default dependencies.

func NewNameGenerator

func NewNameGenerator(
	timeNow func() time.Time,
	randRead func([]byte) (int, error),
) *NameGenerator

NewNameGenerator creates a new NameGenerator.

func (*NameGenerator) Generate

func (ng *NameGenerator) Generate(prefix string) (string, error)

Generate generates a new name with a prefix based on the UnixNano UTC timestamp plus 2 random bytes.

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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