templates

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddlFuncs = map[string]any{
	"pow":                   func(a, b int) int { return int(math.Pow(float64(a), float64(b))) },
	"pseudoRandAlphaNum":    RandAlphaNum,
	"pseudoRandAlpha":       RandAlpha,
	"pseudoRandNumeric":     RandNumeric,
	"pseudoRandString":      RandString,
	"pseudoRandInt":         RandInt,
	"pseudoRandNorm":        RandNorm,
	"weightDatedTimeSample": WeightedDateTimeSampler,
	"nRandInt":              NRandInt,
	"fake":                  Fake,
	"seed":                  Seed,
	"formatPrice":           FormatPrice,
}

Functions

func Fake added in v0.14.0

func Fake(string string) string

func FormatPrice added in v0.14.0

func FormatPrice(currency string, pAny any) string

func NRandInt added in v0.14.0

func NRandInt(nAny, minAny, maxAny any) []int

NRandInt returns n unique values between the min (inclusive) and max (exclusive)

func RandAlpha

func RandAlpha(n int) string

RandAlpha generates a string consisting of characters in the range a-z and A-Z.

func RandAlphaNum

func RandAlphaNum(n int) string

RandAlphaNum generates a string consisting of characters in the range 0-9, a-z, and A-Z.

func RandInt

func RandInt(minA, maxA any) int

RandInt returns a value between the min (inclusive) and max (exclusive)

func RandNorm added in v0.14.0

func RandNorm(meanA any, stdDevA any) float64

RandNorm returns a normal sample with set mean and std deviation.

func RandNumeric

func RandNumeric(n int) string

RandNumeric generates a string consisting of characters in the range 0-9.

func RandString

func RandString(letters string, n int) string

RandString is the internal function that generates a random string. It takes the length of the string and a string of allowed characters as parameters.

func Render

func Render(templateString string) string

func Seed added in v0.14.0

func Seed(x any) string

func WeightedDateTimeSampler added in v0.14.0

func WeightedDateTimeSampler(start string, end string) string

Types

type CurrencyConfig added in v0.14.0

type CurrencyConfig struct {
	DecimalPlaces     int
	DecimalPoint      string
	ThousandSeparator string
	Format            string
}

Jump to

Keyboard shortcuts

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