generator

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2022 License: MIT Imports: 7 Imported by: 1

Documentation

Index

Constants

View Source
const Base32IDSizeBytes = 18

Base32IDSizeBytes is the length of a base 32 identifier in bytes in the system.

View Source
const IDSizeBytes = 32

IDSizeBytes is the length of an identifier in bytes in the system.

View Source
const MaxPrefix = 8

MaxPrefix is the maximum ID prefix length

Variables

This section is empty.

Functions

func Base32ID

func Base32ID(prefix IDPrefix) string

Base32ID creates a random id starting with prefix to idSize length

func Bytes

func Bytes(n int) []byte

Bytes array of length n with random values.

func Code

func Code(length int) string

Code returns random letters & numbers of the requested length

func Email

func Email() string

Email returns a fake email address for testing

func Hex

func Hex(length int) string

Hex returns a hex string of the requested length

func HexColor

func HexColor() string

HexColor returns a 7 length string from #000000 - #FFFFFF

func ID

func ID(prefix IDPrefix) string

ID creates a random id starting with prefix to idSize length

func Int

func Int() int

Int returns a random Int

func Int16

func Int16() int16

Int16 returns a random Int16

func Int32

func Int32() int32

Int32 returns a random Int32

func Name

func Name() string

Name returns a fake name for testing

func Password

func Password(length int) string

Password generates a random password of a given length

func Secret

func Secret() string

Secret returns a string that is suitable as a Salt or a Client Secret

func String

func String(length int) string

String returns random letters of the requested length

func TestID

func TestID() string

TestID returns an ID with a random prefix for testing purposes

func UInt16

func UInt16() uint16

UInt16 returns a random UInt16

func UInt32

func UInt32() uint32

UInt32 returns a random UInt32

func Year

func Year() int32

Year returns random year between 1976 and 2017

Types

type IDPrefix

type IDPrefix string

IDPrefix is the human readable prefix that is attached to a generated ID

Jump to

Keyboard shortcuts

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