values

package
v0.9.6 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseRefValue

func ParseRefValue(value string) string

ParseRefValue passes through the input value to all the supported value generators to get the final value. For example, $RANDOM:5 --> xafce $NOWTIME: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