names

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: Apache-2.0 Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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