names

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator interface {
	PrefixedName(s string) string
}

Generator is implemented by values that generate a prefixed-nane.

type RandomGenerator

type RandomGenerator struct {
	MaxLength int
	SuffixLen int
	// contains filtered or unexported fields
}

RandomGenerator generates a random name prefix.

func New

func New(r *rand.Rand) *RandomGenerator

New creates and returns a RandomGenerator.

func (RandomGenerator) PrefixedName

func (g RandomGenerator) PrefixedName(prefix string) string

PrefixedName generates a name from the prefix with an additional random set of alphabetic characters.

If the prefix + the length of the random set of characters would exceed the MaxLength, then the prefix will be trimmed to accomodate the random string.

If the prefix ends with "-" this will be preserved in the trimmed string, before adding the prefix.

Jump to

Keyboard shortcuts

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