lazy

package
v0.32.0-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: Apache-2.0 Imports: 6 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GetFieldFunc

type GetFieldFunc func(*MapValue) ref.Val

type MapValue

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

MapValue is a map that lazily evaluate its value when a field is first accessed. The map value is not designed to be thread-safe.

func NewMapValue

func NewMapValue(objectType ref.Type) *MapValue

func (*MapValue) Append

func (m *MapValue) Append(name string, callback GetFieldFunc)

Append adds the given field with its name and callback.

func (*MapValue) Contains

func (m *MapValue) Contains(key ref.Val) ref.Val

Contains checks if the key is known to the map

func (*MapValue) ConvertToNative

func (m *MapValue) ConvertToNative(typeDesc reflect.Type) (any, error)

ConvertToNative returns an error because it is disallowed

func (*MapValue) ConvertToType

func (m *MapValue) ConvertToType(typeVal ref.Type) ref.Val

ConvertToType converts the map to the given type. Only its own type and "Type" type are allowed.

func (*MapValue) Equal

func (m *MapValue) Equal(other ref.Val) ref.Val

Equal returns true if the other object is the same pointer-wise.

func (*MapValue) Find

func (m *MapValue) Find(key ref.Val) (ref.Val, bool)

func (*MapValue) Get

func (m *MapValue) Get(key ref.Val) ref.Val

func (*MapValue) Iterator

func (m *MapValue) Iterator() traits.Iterator

Iterator returns an iterator to traverse the map.

func (*MapValue) Size

func (m *MapValue) Size() ref.Val

Size returns the number of currently known fields

func (*MapValue) Type

func (m *MapValue) Type() ref.Type

Type returns its registered type.

func (*MapValue) Value

func (m *MapValue) Value() any

Value is not allowed.

Jump to

Keyboard shortcuts

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