keygen

package module
v0.0.0-...-b2427ea Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2020 License: MIT Imports: 10 Imported by: 0

README

keygen

Actions Status GoDoc Go Report Card codecov

Key-based dummy data generator for Go.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Any

func Any(dst interface{}, keys ...string) interface{}

func Bool

func Bool(keys ...string) *bool

func Float32

func Float32(keys ...string) *float32

func Float64

func Float64(keys ...string) *float64

func Int

func Int(keys ...string) *int

func Int64

func Int64(keys ...string) *int64

func Length

func Length(keys ...string) *int

func String

func String(keys ...string) *string

func Time

func Time(keys ...string) *time.Time

Time returns random time between 2009-11-10 23:00:00 and 2030-01-01 00:00:00.

func URL

func URL(keys ...string) *url.URL

func Uint

func Uint(keys ...string) *uint

func Uint64

func Uint64(keys ...string) *uint64

Types

type CustomGenerator

type CustomGenerator func(g *Generator, args []string, keys []string) (interface{}, error)

type Generator

type Generator struct {
	Reporter         func(err error)
	CustomGenerators map[string]CustomGenerator
	TypeGenerators   map[reflect.Type]TypeGenerator
}

func New

func New() *Generator

func (*Generator) Any

func (g *Generator) Any(dst interface{}, keys ...string) interface{}

func (*Generator) Bool

func (g *Generator) Bool(keys ...string) *bool

func (*Generator) Float32

func (g *Generator) Float32(keys ...string) *float32

func (*Generator) Float64

func (g *Generator) Float64(keys ...string) *float64

func (*Generator) Int

func (g *Generator) Int(keys ...string) *int

func (*Generator) Int64

func (g *Generator) Int64(keys ...string) *int64

func (*Generator) Length

func (g *Generator) Length(keys ...string) *int

func (*Generator) RegisterCustomGenerator

func (g *Generator) RegisterCustomGenerator(name string, gen CustomGenerator)

func (*Generator) RegisterTypeGenerator

func (g *Generator) RegisterTypeGenerator(t interface{}, gen TypeGenerator)

func (*Generator) String

func (g *Generator) String(keys ...string) *string

func (*Generator) Time

func (g *Generator) Time(keys ...string) *time.Time

Time returns random time between 2009-11-10 23:00:00 and 2030-01-01 00:00:00.

func (*Generator) URL

func (g *Generator) URL(keys ...string) *url.URL

func (*Generator) Uint

func (g *Generator) Uint(keys ...string) *uint

func (*Generator) Uint64

func (g *Generator) Uint64(keys ...string) *uint64

type TypeGenerator

type TypeGenerator func(g *Generator, keys []string) (interface{}, error)

Jump to

Keyboard shortcuts

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