values

package
v1.0.0-alpha.2 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2019 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateValue added in v0.9.10

func GenerateValue(value string) string

GenerateValue passes through the input value to all the supported value generators to get the final value. For example, $(random:5) --> xafce $(timenow:RFC3339) --> 2019-05-24T11:10:13+08:00

Types

type Generator

type Generator interface {
	// Value generates a string value according to params. How params is interpreted is determined by the generator implementation.
	Value(interface{}) string
	// Parse parses input string that represents a specific type value. For example, a given length random
	// string. If the input is not a valid given type ref value, the origin input value is returned.
	Parse(v string) string
}

Generator is used to generate specific type of string value, for example, fixed length random string, timestamp.

var (
	// RandomString is used to generate a random string
	RandomString Generator
	// NowTimeString is used to generate current timestamp
	NowTimeString Generator
)

type NowTimeStringParam

type NowTimeStringParam struct {
	Format string `json:"format"`
}

type RandomValueParam

type RandomValueParam struct {
	Length int `json:"length"`
}

Jump to

Keyboard shortcuts

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