testutil

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MakeFieldsFromTraits

func MakeFieldsFromTraits(ts []string) (ret []rt.Field)

func SetRecord

func SetRecord(d *rt.Record, pairs ...interface{}) (err error)

func ValueOf

func ValueOf(i interface{}) (ret rt.Value, err error)

ValueOf returns a new generic value wrapper based on analyzing the passed value.

Types

type FieldMap

type FieldMap map[string]*[]rt.Field // kind name to fields; pointers are used to block recursion

type KindBuilder

type KindBuilder struct {
	Aspects []rt.Aspect
	Fields  FieldMap
	Parents ParentMap
}

type KindMap

type KindMap map[string]*rt.Kind

type Kinds

type Kinds struct {
	Kinds   KindMap // stores completed kinds
	Builder KindBuilder
}

func (*Kinds) AddKinds

func (ks *Kinds) AddKinds(is ...interface{})

register kinds from a struct using reflection note: this doesnt actually create the kinds.... it preps them for use -- they are created on Get()

func (*Kinds) GetKindByName

func (ks *Kinds) GetKindByName(name string) (ret *rt.Kind, err error)

return a kind ( declared via AddKinds ) or error if it doesnt exist.

func (*Kinds) Kind

func (ks *Kinds) Kind(name string) (ret *rt.Kind)

return a kind ( declared via AddKinds ) panic if it doesn't exist.

func (*Kinds) NewRecord

func (ks *Kinds) NewRecord(name string, valuePairs ...interface{}) *rt.Record

type Objects

type Objects map[string]*rt.Record

func (*Objects) AddObjects

func (or *Objects) AddObjects(kind *rt.Kind, names ...string) int

func (*Objects) Names

func (or *Objects) Names() (ret []string)

type PanicRuntime

type PanicRuntime struct{}

PanicRuntime implements Runtime throwing a panic for every method

func (PanicRuntime) ActivateDomain

func (PanicRuntime) ActivateDomain(name string) error

func (PanicRuntime) Call

func (PanicRuntime) GetField

func (PanicRuntime) GetField(target, field string) (rt.Value, error)

func (PanicRuntime) GetKindByName

func (PanicRuntime) GetKindByName(string) (*rt.Kind, error)

func (PanicRuntime) GetRules

func (PanicRuntime) GetRules(pattern, target string) ([]rt.Rule, error)

func (PanicRuntime) PluralOf

func (PanicRuntime) PluralOf(single string) string

func (PanicRuntime) PopScope

func (PanicRuntime) PopScope()

func (PanicRuntime) PushScope

func (PanicRuntime) PushScope(rt.Scope)

func (PanicRuntime) Random

func (PanicRuntime) Random(inclusiveMin, exclusiveMax int) int

func (PanicRuntime) ReciprocalsOf

func (PanicRuntime) ReciprocalsOf(a, relation string) (rt.Value, error)

func (PanicRuntime) RelateTo

func (PanicRuntime) RelateTo(a, b, relation string) error

func (PanicRuntime) RelativesOf

func (PanicRuntime) RelativesOf(a, relation string) (rt.Value, error)

func (PanicRuntime) SetField

func (PanicRuntime) SetField(target, field string, v rt.Value) error

func (PanicRuntime) SetWriter

func (PanicRuntime) SetWriter(io.Writer) io.Writer

func (PanicRuntime) SingularOf

func (PanicRuntime) SingularOf(plural string) string

func (PanicRuntime) Writer

func (PanicRuntime) Writer() io.Writer

type ParentMap

type ParentMap map[string]string

type Runtime

type Runtime struct {
	ObjectMap map[string]*rt.Record
	scope.Chain
	*Kinds
	// contains filtered or unexported fields
}

Runtime - a simple runtime for testing

func (*Runtime) GetField

func (x *Runtime) GetField(target, field string) (ret rt.Value, err error)

func (*Runtime) SetField

func (x *Runtime) SetField(target, field string, value rt.Value) (err error)

func (*Runtime) Writer

func (x *Runtime) Writer() io.Writer

Jump to

Keyboard shortcuts

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