generator

package
v0.0.0-...-1495e9f Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound      = fmt.Errorf("generator not found")
	ErrAlreadyExists = fmt.Errorf("generator already exists")
)

Functions

This section is empty.

Types

type Generator

type Generator struct {
	Slug     string   `bson:"_id"`
	Name     string   `bson:"name"`
	Key      string   `bson:"key,omitempty"`
	Template string   `bson:"template,omitempty"`
	Field1   []string `bson:"field1,omitempty"`
	Field2   []string `bson:"field2,omitempty"`
	Field3   []string `bson:"field3,omitempty"`
	Field4   []string `bson:"field4,omitempty"`
	Field5   []string `bson:"field5,omitempty"`
	Field6   []string `bson:"field6,omitempty"`
	// contains filtered or unexported fields
}

Generator represents an arbitrary generator

func (*Generator) Generate

func (g *Generator) Generate() []byte

Generate generates a random slice of bytes

func (*Generator) GenerateN

func (g *Generator) GenerateN(n int) [][]byte

GenerateN returns a slice of slices of bytes

func (*Generator) GenerateNJoined

func (g *Generator) GenerateNJoined(n int, sep string) []byte

GenerateNJoined generates a slice of bytes joined by the given separator

func (*Generator) SetGenFunc

func (g *Generator) SetGenFunc(genFunc func(string) string)

type Store

type Store interface {
	All() ([]*Generator, error)
	Find(slug string) (*Generator, error)
	Update(g *Generator) error
	Create(g *Generator) error
}

Jump to

Keyboard shortcuts

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