chain

package
v1.2.10 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2022 License: Apache-2.0 Imports: 15 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractConstants

func ExtractConstants(x interface{}) (map[string]byte, error)

ExtractConstants takes an interface which should be a Go language struct with "chain" Struct Tags, and extracts a map of names to indices in the generated vm struct

func ToValue

func ToValue(x interface{}) (vm.Value, error)

ToValue returns a Go value as a VM value, including if the Go value is a struct or array. Structs may be nested. Struct fields with missing or empty `chain:` tags are skipped. Arrays create a list of values in the array

func ToValueScalar

func ToValueScalar(x interface{}) (vm.Value, error)

ToValueScalar converts a scalar value to a VM Value object it handles ints of several types, bool, string, time.Time, and pointers to these.

Types

type SeededRand

type SeededRand struct {
	// contains filtered or unexported fields
}

SeededRand is a random number generator that conforms to Randomer. It accepts a seed at initialization and generates a predictable sequence thereafter.

func NewSeededRand

func NewSeededRand(ba []byte) (*SeededRand, error)

NewSeededRand returns a new instance of a SeededRand.

func (*SeededRand) RandInt

func (sr *SeededRand) RandInt() (int64, error)

RandInt implements Randomer for SeededRand.

func (*SeededRand) Seed

func (sr *SeededRand) Seed(seed int64)

Seed sets the seed for the current SeededRand object. Note that seeding is expensive; doing NewSeededRand takes only a tiny amount longer than reseeding an existing random number generator.

Jump to

Keyboard shortcuts

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