dytengo

package module
v0.0.0-...-63c2866 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2023 License: MIT Imports: 5 Imported by: 0

README

dytengo

A small wrapper for d5/tengo that adds some nice features

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrArrayNil = errors.New("cannot index nil array")
View Source
var ErrIndexNotAssignable = errors.New("index cannot be set")
View Source
var ErrMapIsNil = errors.New("cannot index nil map")
View Source
var ErrStructNotPointer = errors.New("from interface recieved non pointer struct")

Functions

func FromInterface

func FromInterface(v any) (tengo.Object, error)

func ToInterface

func ToInterface(o tengo.Object) any

Types

type DyArray

type DyArray struct {
	tengo.ObjectImpl
	Value reflect.Value
	// contains filtered or unexported fields
}

func (*DyArray) BinaryOp

func (o *DyArray) BinaryOp(_ token.Token, _ tengo.Object) (tengo.Object, error)

BinaryOp returns another object that is the result of a given binary operator and a right-hand side object.

func (*DyArray) CanIterate

func (o *DyArray) CanIterate() bool

CanIterate returns whether the Object can be Iterated.

func (*DyArray) Copy

func (o *DyArray) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyArray) Equals

func (o *DyArray) Equals(x tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyArray) IndexGet

func (o *DyArray) IndexGet(index tengo.Object) (res tengo.Object, err error)

IndexGet returns an element at a given index.

func (*DyArray) IndexSet

func (o *DyArray) IndexSet(index, val tengo.Object) (err error)

IndexSet sets an element at a given index.

func (*DyArray) IsFalsy

func (o *DyArray) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyArray) Iterate

func (o *DyArray) Iterate() tengo.Iterator

Iterate returns an iterator.

func (*DyArray) MarshalJSON

func (o *DyArray) MarshalJSON() ([]byte, error)

func (*DyArray) String

func (o *DyArray) String() string

func (*DyArray) TypeName

func (o *DyArray) TypeName() string

TypeName returns the name of the type.

func (*DyArray) UnmarshalJSON

func (o *DyArray) UnmarshalJSON(data []byte) error

type DyArrayIterator

type DyArrayIterator struct {
	tengo.ObjectImpl
	// contains filtered or unexported fields
}

DyArrayIterator is an iterator for an array.

func (*DyArrayIterator) Copy

func (i *DyArrayIterator) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyArrayIterator) Equals

func (i *DyArrayIterator) Equals(tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyArrayIterator) IsFalsy

func (i *DyArrayIterator) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyArrayIterator) Key

func (i *DyArrayIterator) Key() tengo.Object

Key returns the key or index value of the current element.

func (*DyArrayIterator) Next

func (i *DyArrayIterator) Next() bool

Next returns true if there are more elements to iterate.

func (*DyArrayIterator) String

func (i *DyArrayIterator) String() string

func (*DyArrayIterator) TypeName

func (i *DyArrayIterator) TypeName() string

TypeName returns the name of the type.

func (*DyArrayIterator) Value

func (i *DyArrayIterator) Value() tengo.Object

Value returns the value of the current element.

type DyFunc

type DyFunc struct {
	tengo.ObjectImpl
	Value reflect.Value
	// contains filtered or unexported fields
}

func (*DyFunc) Call

func (o *DyFunc) Call(args ...tengo.Object) (ret tengo.Object, err error)

Call takes an arbitrary number of arguments and returns a return value and/or an error.

func (*DyFunc) CanCall

func (o *DyFunc) CanCall() bool

CanCall returns whether the Object can be Called.

func (*DyFunc) Copy

func (o *DyFunc) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyFunc) String

func (o *DyFunc) String() string

func (*DyFunc) TypeName

func (o *DyFunc) TypeName() string

TypeName returns the name of the type.

type DyMap

type DyMap struct {
	tengo.ObjectImpl
	Value reflect.Value
	// contains filtered or unexported fields
}

func (*DyMap) BinaryOp

func (o *DyMap) BinaryOp(_ token.Token, _ tengo.Object) (tengo.Object, error)

BinaryOp returns another object that is the result of a given binary operator and a right-hand side object.

func (*DyMap) CanIterate

func (o *DyMap) CanIterate() bool

CanIterate returns whether the Object can be Iterated.

func (*DyMap) Copy

func (o *DyMap) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyMap) Equals

func (o *DyMap) Equals(x tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyMap) IndexGet

func (o *DyMap) IndexGet(index tengo.Object) (res tengo.Object, err error)

IndexGet returns an element at a given index.

func (*DyMap) IndexSet

func (o *DyMap) IndexSet(index, val tengo.Object) (err error)

IndexSet sets an element at a given index.

func (*DyMap) IsFalsy

func (o *DyMap) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyMap) Iterate

func (o *DyMap) Iterate() tengo.Iterator

Iterate returns an iterator.

func (*DyMap) MarshalJSON

func (o *DyMap) MarshalJSON() ([]byte, error)

func (*DyMap) String

func (o *DyMap) String() string

func (*DyMap) TypeName

func (o *DyMap) TypeName() string

TypeName returns the name of the type.

func (*DyMap) UnmarshalJSON

func (o *DyMap) UnmarshalJSON(data []byte) error

type DyMapIterator

type DyMapIterator struct {
	tengo.ObjectImpl
	// contains filtered or unexported fields
}

DyMapIterator represents an iterator for the map.

func (*DyMapIterator) Copy

func (i *DyMapIterator) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyMapIterator) Equals

func (i *DyMapIterator) Equals(tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyMapIterator) IsFalsy

func (i *DyMapIterator) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyMapIterator) Key

func (i *DyMapIterator) Key() tengo.Object

Key returns the key or index value of the current element.

func (*DyMapIterator) Next

func (i *DyMapIterator) Next() bool

Next returns true if there are more elements to iterate.

func (*DyMapIterator) String

func (i *DyMapIterator) String() string

func (*DyMapIterator) TypeName

func (i *DyMapIterator) TypeName() string

TypeName returns the name of the type.

func (*DyMapIterator) Value

func (i *DyMapIterator) Value() tengo.Object

Value returns the value of the current element.

type DyScript

type DyScript struct {
	*tengo.Script
}

func NewScript

func NewScript(src []byte) *DyScript

func (*DyScript) Add

func (s *DyScript) Add(name string, value any) error

type DyStruct

type DyStruct struct {
	tengo.ObjectImpl
	Value reflect.Value
	// contains filtered or unexported fields
}

func (*DyStruct) BinaryOp

func (o *DyStruct) BinaryOp(_ token.Token, _ tengo.Object) (tengo.Object, error)

BinaryOp returns another object that is the result of a given binary operator and a right-hand side object.

func (*DyStruct) CanIterate

func (o *DyStruct) CanIterate() bool

CanIterate returns whether the Object can be Iterated.

func (*DyStruct) Copy

func (o *DyStruct) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyStruct) Equals

func (o *DyStruct) Equals(x tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyStruct) IndexGet

func (o *DyStruct) IndexGet(key tengo.Object) (res tengo.Object, err error)

IndexGet returns an element at a given index.

func (*DyStruct) IndexSet

func (o *DyStruct) IndexSet(key, val tengo.Object) error

IndexSet sets an element at a given index.

func (*DyStruct) IsFalsy

func (o *DyStruct) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyStruct) Iterate

func (o *DyStruct) Iterate() tengo.Iterator

Iterate returns an iterator.

func (*DyStruct) MarshalJSON

func (o *DyStruct) MarshalJSON() ([]byte, error)

func (*DyStruct) String

func (o *DyStruct) String() string

func (*DyStruct) TypeName

func (o *DyStruct) TypeName() string

TypeName returns the name of the type.

func (*DyStruct) UnmarshalJSON

func (o *DyStruct) UnmarshalJSON(data []byte) error

type DyStructIterator

type DyStructIterator struct {
	tengo.ObjectImpl
	// contains filtered or unexported fields
}

DyArrayIterator is an iterator for an array.

func (*DyStructIterator) Copy

func (i *DyStructIterator) Copy() tengo.Object

Copy returns a copy of the type.

func (*DyStructIterator) Equals

func (i *DyStructIterator) Equals(tengo.Object) bool

Equals returns true if the value of the type is equal to the value of another object.

func (*DyStructIterator) IsFalsy

func (i *DyStructIterator) IsFalsy() bool

IsFalsy returns true if the value of the type is falsy.

func (*DyStructIterator) Key

func (i *DyStructIterator) Key() tengo.Object

Key returns the key or index value of the current element.

func (*DyStructIterator) Next

func (i *DyStructIterator) Next() bool

Next returns true if there are more elements to iterate.

func (*DyStructIterator) String

func (i *DyStructIterator) String() string

func (*DyStructIterator) TypeName

func (i *DyStructIterator) TypeName() string

TypeName returns the name of the type.

func (*DyStructIterator) Value

func (i *DyStructIterator) Value() tengo.Object

Value returns the value of the current element.

Jump to

Keyboard shortcuts

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