generator

package
v0.1.5 Latest Latest
Warning

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

Go to latest
Published: Dec 17, 2019 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package generator encapsulates the structure which is in charge of populating the petname array

Index

Constants

View Source
const (
	// NameTemplate is the call value for templating names
	NameTemplate = "Name"
	// AdjectiveTemplate is the call value for templating adjectives
	AdjectiveTemplate = "Adjective"
	// AdverbTemplate is the call value for templating adverbs
	AdverbTemplate = "Adverb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Name          string
	Used          *cache.Cache
	Template      *template.Template
	Adjectives    []string
	Adverbs       []string
	Names         []string
	AvailableAdv  int
	AvailableAdj  int
	AvailableName int
}

Generator encapsulates all functions that allow for the unique generation of a petname

func (*Generator) Get

func (g *Generator) Get() (string, error)

Get generates an unique petname and returns that string

func (*Generator) New

func (g *Generator) New(t string, n string) error

New generates a new generator from a given template If template does not follow the const given will return empty generator

Jump to

Keyboard shortcuts

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