corevalue

package
v0.0.0-...-2561dba Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// GetFuncName is the name this function is registered as. This variant
	// is the fanciest version, although type unification is much more
	// difficult when using this.
	// XXX: type unification doesn't work perfectly here yet... maybe a bug with returned structs?
	GetFuncName = "get"

	// GetBoolFuncName is the name this function is registered as. This
	// variant can only pull in values of type bool.
	GetBoolFuncName = "get_bool"

	// GetStrFuncName is the name this function is registered as. This
	// variant can only pull in values of type str.
	GetStrFuncName = "get_str"

	// GetIntFuncName is the name this function is registered as. This
	// variant can only pull in values of type int.
	GetIntFuncName = "get_int"

	// GetFloatFuncName is the name this function is registered as. This
	// variant can only pull in values of type float.
	GetFloatFuncName = "get_float"
)
View Source
const (
	// ModuleName is the prefix given to all the functions in this module.
	ModuleName = "value"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GetFunc

type GetFunc struct {
	// Type is the actual type being used for the value we are looking up.
	Type *types.Type
	// contains filtered or unexported fields
}

GetFunc is special function which looks up the stored `Any` field in the value resource that it gets it from. If it is initialized with a fixed Type field, then it becomes a statically typed version that can only return keys of that type. It is instead recommended to use the Get* functions that are more strictly typed.

func (*GetFunc) ArgGen

func (obj *GetFunc) ArgGen(index int) (string, error)

ArgGen returns the Nth arg name for this function.

func (*GetFunc) Build

func (obj *GetFunc) Build(typ *types.Type) (*types.Type, error)

Build is run to turn the polymorphic, undetermined function, into the specific statically typed version. It is usually run after Unify completes, and must be run before Info() and any of the other Func interface methods are used. This function is idempotent, as long as the arg isn't changed between runs.

func (*GetFunc) Info

func (obj *GetFunc) Info() *interfaces.Info

Info returns some static info about itself.

func (*GetFunc) Init

func (obj *GetFunc) Init(init *interfaces.Init) error

Init runs some startup code for this function.

func (*GetFunc) Stream

func (obj *GetFunc) Stream(ctx context.Context) error

Stream returns the changing values that this func has over time.

func (*GetFunc) String

func (obj *GetFunc) String() string

String returns a simple name for this function. This is needed so this struct can satisfy the pgraph.Vertex interface.

func (*GetFunc) Validate

func (obj *GetFunc) Validate() error

Validate makes sure we've built our struct properly. It is usually unused for normal functions that users can use directly.

Jump to

Keyboard shortcuts

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