builtin

package
v0.0.0-...-07525cc Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2021 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultRestrain = 0.0

Variables

This section is empty.

Functions

func Bag

func Bag(scope common.Scope, args ...interface{}) interface{}

Bag will fetch a random line from file and return it. args[0] - filename.

func Choice

func Choice(scope common.Scope, args ...interface{}) interface{}

Choice will randomly pick one of the passed argument and return back.

func Chr

func Chr(scope common.Scope, args ...interface{}) interface{}

Chr returns a character as string.

func Dec

func Dec(scope common.Scope, args ...interface{}) interface{}

Dec will decrement a variable. args[0] - variable name args[1] - quantum of value to decrement if variable name is present in local scope it will be used, otherwise variable name from global scope is used.

func Global

func Global(scope common.Scope, args ...interface{}) interface{}

Global will define a set of one or more variables in global scope. args[0], args[2] ... args[N-1] - variable name args[1], args[3] ... args[N] - variable value

func Inc

func Inc(scope common.Scope, args ...interface{}) interface{}

Inc will increment a variable. args[0] - variable name args[1] - quantum of value to increment if variable name is present in local scope it will be used, otherwise variable name from global scope is used.

func Len

func Len(scope common.Scope, args ...interface{}) interface{}

Len will return the length of string in args[0]

func Let

func Let(scope common.Scope, args ...interface{}) interface{}

Let will define a set of one or more variables in local scope. args[0], args[2] ... args[N-1] - variable name args[1], args[3] ... args[N] - variable value

func Letr

func Letr(scope common.Scope, args ...interface{}) interface{}

Letr will define a single variables in local scope and return the same. args[0], args[2] ... args[N-1] - variable name args[1], args[3] ... args[N] - variable value

func Multf

func Multf(scope common.Scope, args ...interface{}) interface{}

func Range

func Range(scope common.Scope, args ...interface{}) interface{}

Range will randomly pick a value from args[0] to args[1] and return the same. args... are expected to be in int64

func Rangef

func Rangef(scope common.Scope, args ...interface{}) interface{}

Rangef will randomly pick a value from args[0] to args[1] and return the same. args... are expected to be in float64

func Ranget

func Ranget(scope common.Scope, args ...interface{}) interface{}

Ranget will randomly pick a value from args[0] to args[1] and return the same. args... are expected to be in time.RFC3339 format

func Sprintf

func Sprintf(scope common.Scope, args ...interface{}) interface{}

Sprintf is same as golang.Printf

func UnixNano

func UnixNano(scope common.Scope, args ...interface{}) interface{}

func Uuid

func Uuid(scope common.Scope, args ...interface{}) interface{}

Uuid returns a unique value based on current nanosecond timestamp.

func Weigh

func Weigh(scope common.Scope, args ...interface{}) interface{}

Weigh can be used as the first form in any rule, to define its choice preference for or grammar.

Types

type UUID

type UUID []byte

func (UUID) Str

func (u UUID) Str() string

func (UUID) Uint64

func (u UUID) Uint64() uint64

Jump to

Keyboard shortcuts

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