Documentation ¶
Overview ¶
Package object defines the standard set of object types in Tamarin.
For external users of Tamarin, often an object.Object interface will be type asserted to a specific object type, such as *object.Float.
For example:
switch obj := obj.(type) { case *object.String: // do something with obj.Value() case *object.Float: // do something with obj.Value() }
The Type() method of each object may also be used to get a string name of the object type, such as "string" or "float".
Index ¶
- Constants
- Variables
- func AsList(obj Object) (*List, *Error)
- func AsMap(obj Object) (*Map, *Error)
- func AsSet(obj Object) (*Set, *Error)
- func CompareTypes(a, b Object) int
- func Equals(a, b Object) bool
- func GetLimits(ctx context.Context) (*limits.Limits, bool)
- func IsError(obj Object) bool
- func ResolveIndex(idx int64, size int64) (int64, error)
- func ResolveIntSlice(slice Slice, size int64) (start int64, stop int64, err error)
- func WithCallFunc(ctx context.Context, fn CallFunc) context.Context
- func WithCodeFunc(ctx context.Context, fn CodeFunc) context.Context
- func WithLimits(ctx context.Context, l *limits.Limits) context.Context
- type BSlice
- func (b *BSlice) Clone() *BSlice
- func (b *BSlice) Compare(other Object) (int, error)
- func (b *BSlice) Contains(obj Object) *Bool
- func (b *BSlice) ContainsAny(obj Object) Object
- func (b *BSlice) ContainsRune(obj Object) Object
- func (b *BSlice) Count(obj Object) Object
- func (b *BSlice) DelItem(key Object) *Error
- func (b *BSlice) Equals(other Object) Object
- func (b *BSlice) GetAttr(name string) (Object, bool)
- func (b *BSlice) GetItem(key Object) (Object, *Error)
- func (b *BSlice) GetSlice(slice Slice) (Object, *Error)
- func (b *BSlice) HasPrefix(obj Object) Object
- func (b *BSlice) HasSuffix(obj Object) Object
- func (b *BSlice) HashKey() HashKey
- func (b *BSlice) Index(obj Object) Object
- func (b *BSlice) IndexAny(obj Object) Object
- func (b *BSlice) IndexByte(obj Object) Object
- func (b *BSlice) IndexRune(obj Object) Object
- func (b *BSlice) Inspect() string
- func (b *BSlice) Integers() []Object
- func (b *BSlice) Interface() interface{}
- func (b *BSlice) IsTruthy() bool
- func (b *BSlice) Iter() Iterator
- func (b *BSlice) Len() *Int
- func (b *BSlice) Repeat(obj Object) Object
- func (b *BSlice) Replace(old, new, count Object) Object
- func (b *BSlice) ReplaceAll(old, new Object) Object
- func (b *BSlice) Reversed() *BSlice
- func (b *BSlice) RunOperation(opType op.BinaryOpType, right Object) Object
- func (b *BSlice) SetItem(key, value Object) *Error
- func (b *BSlice) String() string
- func (b *BSlice) Type() Type
- func (b *BSlice) Value() []byte
- type BSliceIter
- func (iter *BSliceIter) Equals(other Object) Object
- func (iter *BSliceIter) GetAttr(name string) (Object, bool)
- func (iter *BSliceIter) Inspect() string
- func (iter *BSliceIter) Interface() interface{}
- func (iter *BSliceIter) IsTruthy() bool
- func (iter *BSliceIter) Next() (IteratorEntry, bool)
- func (iter *BSliceIter) RunOperation(opType op.BinaryOpType, right Object) Object
- func (iter *BSliceIter) String() string
- func (iter *BSliceIter) Type() Type
- type Bool
- func (b *Bool) Compare(other Object) (int, error)
- func (b *Bool) Equals(other Object) Object
- func (b *Bool) GetAttr(name string) (Object, bool)
- func (b *Bool) HashKey() HashKey
- func (b *Bool) Inspect() string
- func (b *Bool) Interface() interface{}
- func (b *Bool) IsTruthy() bool
- func (b *Bool) RunOperation(opType op.BinaryOpType, right Object) Object
- func (b *Bool) String() string
- func (b *Bool) Type() Type
- func (b *Bool) Value() bool
- type BooleanConverter
- type Builtin
- func (b *Builtin) Call(ctx context.Context, args ...Object) Object
- func (b *Builtin) Equals(other Object) Object
- func (b *Builtin) GetAttr(name string) (Object, bool)
- func (b *Builtin) Inspect() string
- func (b *Builtin) Interface() interface{}
- func (b *Builtin) IsErrorHandler() bool
- func (b *Builtin) IsTruthy() bool
- func (b *Builtin) Key() string
- func (b *Builtin) Name() string
- func (b *Builtin) RunOperation(opType op.BinaryOpType, right Object) Object
- func (b *Builtin) String() string
- func (b *Builtin) Type() Type
- func (b *Builtin) Value() BuiltinFunction
- type BuiltinFunction
- type BytesConverter
- type CallFunc
- type Cell
- type Code
- type CodeFunc
- type CodeProxy
- func (c *CodeProxy) Equals(other Object) Object
- func (c *CodeProxy) GetAttr(name string) (Object, bool)
- func (c *CodeProxy) Inspect() string
- func (c *CodeProxy) Interface() interface{}
- func (c *CodeProxy) IsTruthy() bool
- func (c *CodeProxy) RunOperation(opType op.BinaryOpType, right Object) Object
- func (c *CodeProxy) String() string
- func (c *CodeProxy) Type() Type
- type Color
- func (c *Color) Compare(other Object) (int, error)
- func (c *Color) Equals(other Object) Object
- func (c *Color) GetAttr(name string) (Object, bool)
- func (c *Color) Inspect() string
- func (c *Color) Interface() interface{}
- func (c *Color) IsTruthy() bool
- func (c *Color) RunOperation(opType op.BinaryOpType, right Object) Object
- func (c *Color) String() string
- func (c *Color) Type() Type
- func (c *Color) Value() color.Color
- type Comparable
- type Container
- type ContextConverter
- type DefaultImpl
- func (d *DefaultImpl) Equals(other Object) Object
- func (d *DefaultImpl) GetAttr(name string) (Object, bool)
- func (d *DefaultImpl) Inspect() string
- func (d *DefaultImpl) Interface() interface{}
- func (d *DefaultImpl) IsTruthy() bool
- func (d *DefaultImpl) RunOperation(opType op.BinaryOpType, right Object) Object
- func (d *DefaultImpl) Type() Type
- type DefaultTypeRegistry
- type Entry
- func (e *Entry) Equals(other Object) Object
- func (e *Entry) GetAttr(name string) (Object, bool)
- func (e *Entry) Inspect() string
- func (e *Entry) Interface() interface{}
- func (e *Entry) IsTruthy() bool
- func (e *Entry) Key() Object
- func (e *Entry) Primary() Object
- func (e *Entry) RunOperation(opType op.BinaryOpType, right Object) Object
- func (e *Entry) Type() Type
- func (e *Entry) Value() Object
- func (e *Entry) WithKeyAsPrimary() *Entry
- func (e *Entry) WithValueAsPrimary() *Entry
- type Error
- func AsBool(obj Object) (bool, *Error)
- func AsBytes(obj Object) ([]byte, *Error)
- func AsFloat(obj Object) (float64, *Error)
- func AsInt(obj Object) (int64, *Error)
- func AsString(obj Object) (string, *Error)
- func AsTime(obj Object) (result time.Time, err *Error)
- func Errorf(format string, a ...interface{}) *Error
- func NewArgsError(fn string, takes, given int) *Error
- func NewArgsRangeError(fn string, takesMin, takesMax, given int) *Error
- func NewError(err error) *Error
- func Sort(items []Object) *Error
- func (e *Error) Compare(other Object) (int, error)
- func (e *Error) Equals(other Object) Object
- func (e *Error) GetAttr(name string) (Object, bool)
- func (e *Error) Inspect() string
- func (e *Error) Interface() interface{}
- func (e *Error) IsTruthy() bool
- func (e *Error) Message() *String
- func (e *Error) RunOperation(opType op.BinaryOpType, right Object) Object
- func (e *Error) String() string
- func (e *Error) Type() Type
- func (e *Error) Value() error
- type ErrorConverter
- type File
- func (f *File) Close() error
- func (f *File) Compare(other Object) (int, error)
- func (f *File) Equals(other Object) Object
- func (f *File) GetAttr(name string) (Object, bool)
- func (f *File) Inspect() string
- func (f *File) Interface() interface{}
- func (f *File) IsTruthy() bool
- func (f *File) Read(p []byte) (n int, err error)
- func (f *File) RunOperation(opType op.BinaryOpType, right Object) Object
- func (f *File) Seek(offset int64, whence int) (int64, error)
- func (f *File) String() string
- func (f *File) Type() Type
- func (f *File) Value() *os.File
- func (f *File) Write(p []byte) (n int, err error)
- type Float
- func (f *Float) Compare(other Object) (int, error)
- func (f *Float) Equals(other Object) Object
- func (f *Float) GetAttr(name string) (Object, bool)
- func (f *Float) HashKey() HashKey
- func (f *Float) Inspect() string
- func (f *Float) Interface() interface{}
- func (f *Float) IsTruthy() bool
- func (f *Float) RunOperation(opType op.BinaryOpType, right Object) Object
- func (f *Float) String() string
- func (f *Float) Type() Type
- func (f *Float) Value() float64
- type Float32Converter
- type Float64Converter
- type Function
- func (f *Function) Code() *Code
- func (f *Function) Defaults() []Object
- func (f *Function) FreeVars() []*Cell
- func (f *Function) Inspect() string
- func (f *Function) Instructions() []op.Code
- func (f *Function) LocalsCount() int
- func (f *Function) Name() string
- func (f *Function) Parameters() []string
- func (f *Function) RequiredArgsCount() int
- func (f *Function) String() string
- func (f *Function) Type() Type
- type FunctionOpts
- type GoAttr
- type GoAttrType
- type GoField
- type GoMethod
- type GoType
- func (gt *GoType) AttrByName(name string) (GoAttr, bool)
- func (gt *GoType) Attrs() []GoAttr
- func (gt *GoType) FieldByName(name string) (*GoField, bool)
- func (gt *GoType) Fields() []*GoField
- func (gt *GoType) MethodByName(name string) (*GoMethod, bool)
- func (gt *GoType) Methods() []*GoMethod
- func (gt *GoType) Name() string
- func (gt *GoType) StructType() reflect.Type
- func (gt *GoType) Type() reflect.Type
- type GoTypeRegistry
- type HashKey
- type Hashable
- type HttpResponse
- func (r *HttpResponse) Close()
- func (r *HttpResponse) ContentLength() *Int
- func (r *HttpResponse) Equals(other Object) Object
- func (r *HttpResponse) GetAttr(name string) (Object, bool)
- func (r *HttpResponse) Header() *Map
- func (r *HttpResponse) Inspect() string
- func (r *HttpResponse) Interface() interface{}
- func (r *HttpResponse) IsTruthy() bool
- func (r *HttpResponse) JSON() Object
- func (r *HttpResponse) Proto() *String
- func (r *HttpResponse) RunOperation(opType op.BinaryOpType, right Object) Object
- func (r *HttpResponse) Status() *String
- func (r *HttpResponse) StatusCode() *Int
- func (r *HttpResponse) Text() Object
- func (r *HttpResponse) Type() Type
- type Image
- func (img *Image) Bounds() Object
- func (img *Image) Compare(other Object) (int, error)
- func (img *Image) Equals(other Object) Object
- func (img *Image) GetAttr(name string) (Object, bool)
- func (img *Image) Inspect() string
- func (img *Image) Interface() interface{}
- func (img *Image) IsTruthy() bool
- func (img *Image) RunOperation(opType op.BinaryOpType, right Object) Object
- func (img *Image) String() string
- func (img *Image) Type() Type
- func (img *Image) Value() image.Image
- type Int
- func (i *Int) Compare(other Object) (int, error)
- func (i *Int) Equals(other Object) Object
- func (i *Int) GetAttr(name string) (Object, bool)
- func (i *Int) HashKey() HashKey
- func (i *Int) Inspect() string
- func (i *Int) Interface() interface{}
- func (i *Int) IsTruthy() bool
- func (i *Int) RunOperation(opType op.BinaryOpType, right Object) Object
- func (i *Int) String() string
- func (i *Int) Type() Type
- func (i *Int) Value() int64
- type Int64Converter
- type IntConverter
- type Iterator
- type IteratorEntry
- type List
- func (ls *List) Append(obj Object)
- func (ls *List) Clear()
- func (ls *List) Compare(other Object) (int, error)
- func (ls *List) Contains(item Object) *Bool
- func (ls *List) Copy() *List
- func (ls *List) Count(obj Object) int64
- func (ls *List) DelItem(key Object) *Error
- func (ls *List) Each(ctx context.Context, fn Object) Object
- func (ls *List) Equals(other Object) Object
- func (ls *List) Extend(other *List)
- func (ls *List) Filter(ctx context.Context, fn Object) Object
- func (ls *List) GetAttr(name string) (Object, bool)
- func (ls *List) GetItem(key Object) (Object, *Error)
- func (ls *List) GetSlice(s Slice) (Object, *Error)
- func (ls *List) Index(obj Object) int64
- func (ls *List) Insert(index int64, obj Object)
- func (ls *List) Inspect() string
- func (ls *List) Interface() interface{}
- func (ls *List) IsTruthy() bool
- func (ls *List) Iter() Iterator
- func (ls *List) Keys() Object
- func (ls *List) Len() *Int
- func (ls *List) Map(ctx context.Context, fn Object) Object
- func (ls *List) Pop(index int64) Object
- func (ls *List) Remove(obj Object)
- func (ls *List) Reverse()
- func (ls *List) Reversed() *List
- func (ls *List) RunOperation(opType op.BinaryOpType, right Object) Object
- func (ls *List) SetItem(key, value Object) *Error
- func (ls *List) String() string
- func (ls *List) Type() Type
- func (ls *List) Value() []Object
- type ListIter
- func (iter *ListIter) Equals(other Object) Object
- func (iter *ListIter) GetAttr(name string) (Object, bool)
- func (iter *ListIter) Inspect() string
- func (iter *ListIter) Interface() interface{}
- func (iter *ListIter) IsTruthy() bool
- func (iter *ListIter) Next() (IteratorEntry, bool)
- func (iter *ListIter) RunOperation(opType op.BinaryOpType, right Object) Object
- func (iter *ListIter) String() string
- func (iter *ListIter) Type() Type
- type Loop
- type Map
- func (m *Map) Clear()
- func (m *Map) Contains(key Object) *Bool
- func (m *Map) Copy() *Map
- func (m *Map) DelItem(key Object) *Error
- func (m *Map) Delete(key string) Object
- func (m *Map) Equals(other Object) Object
- func (m *Map) Get(key string) Object
- func (m *Map) GetAttr(name string) (Object, bool)
- func (m *Map) GetItem(key Object) (Object, *Error)
- func (m *Map) GetSlice(s Slice) (Object, *Error)
- func (m *Map) GetWithDefault(key string, defaultValue Object) Object
- func (m *Map) GetWithObject(key *String) Object
- func (m *Map) Inspect() string
- func (m *Map) Interface() interface{}
- func (m *Map) IsTruthy() bool
- func (m *Map) Iter() Iterator
- func (m *Map) Keys() *List
- func (m *Map) Len() *Int
- func (m *Map) ListItems() *List
- func (m *Map) Pop(key string, def Object) Object
- func (m *Map) RunOperation(opType op.BinaryOpType, right Object) Object
- func (m *Map) Set(key string, value Object)
- func (m *Map) SetDefault(key string, value Object) Object
- func (m *Map) SetItem(key, value Object) *Error
- func (m *Map) Size() int
- func (m *Map) SortedKeys() []string
- func (m *Map) String() string
- func (m *Map) StringKeys() []string
- func (m *Map) Type() Type
- func (m *Map) Update(other *Map)
- func (m *Map) Value() map[string]Object
- func (m *Map) Values() *List
- type MapIter
- func (iter *MapIter) Equals(other Object) Object
- func (iter *MapIter) GetAttr(name string) (Object, bool)
- func (iter *MapIter) Inspect() string
- func (iter *MapIter) Interface() interface{}
- func (iter *MapIter) IsTruthy() bool
- func (iter *MapIter) Next() (IteratorEntry, bool)
- func (iter *MapIter) RunOperation(opType op.BinaryOpType, right Object) Object
- func (iter *MapIter) String() string
- func (iter *MapIter) Type() Type
- type MapStringIfaceConverter
- type Module
- func (m *Module) Code() *Code
- func (m *Module) Compare(other Object) (int, error)
- func (m *Module) Equals(other Object) Object
- func (m *Module) GetAttr(name string) (Object, bool)
- func (m *Module) Inspect() string
- func (m *Module) Interface() interface{}
- func (m *Module) IsTruthy() bool
- func (m *Module) Name() *String
- func (m *Module) RunOperation(opType op.BinaryOpType, right Object) Object
- func (m *Module) String() string
- func (m *Module) Type() Type
- type NilType
- func (n *NilType) Compare(other Object) (int, error)
- func (n *NilType) Equals(other Object) Object
- func (n *NilType) GetAttr(name string) (Object, bool)
- func (n *NilType) HashKey() HashKey
- func (n *NilType) Inspect() string
- func (n *NilType) Interface() interface{}
- func (n *NilType) IsTruthy() bool
- func (n *NilType) RunOperation(opType op.BinaryOpType, right Object) Object
- func (n *NilType) String() string
- func (n *NilType) Type() Type
- type Object
- type Partial
- func (f *Partial) Args() []Object
- func (f *Partial) Equals(other Object) Object
- func (f *Partial) Function() Object
- func (f *Partial) GetAttr(name string) (Object, bool)
- func (f *Partial) Inspect() string
- func (f *Partial) Interface() interface{}
- func (f *Partial) IsTruthy() bool
- func (f *Partial) RunOperation(opType op.BinaryOpType, right Object) Object
- func (f *Partial) Type() Type
- type Proxy
- func (p *Proxy) Equals(other Object) Object
- func (p *Proxy) GetAttr(name string) (Object, bool)
- func (p *Proxy) Inspect() string
- func (p *Proxy) Interface() interface{}
- func (p *Proxy) IsTruthy() bool
- func (p *Proxy) RunOperation(opType op.BinaryOpType, right Object) Object
- func (p *Proxy) String() string
- func (p *Proxy) Type() Type
- type Resolution
- type Result
- func (rv *Result) Equals(other Object) Object
- func (rv *Result) ErrMsg() *String
- func (rv *Result) Expect(other Object) Object
- func (rv *Result) GetAttr(name string) (Object, bool)
- func (rv *Result) Inspect() string
- func (rv *Result) Interface() interface{}
- func (rv *Result) IsErr() bool
- func (rv *Result) IsOk() bool
- func (rv *Result) IsTruthy() bool
- func (rv *Result) RunOperation(opType op.BinaryOpType, right Object) Object
- func (rv *Result) String() string
- func (rv *Result) Type() Type
- func (rv *Result) Unwrap() Object
- func (rv *Result) UnwrapErr() *Error
- func (rv *Result) UnwrapOr(other Object) Object
- type ScopeName
- type Set
- func (s *Set) Add(items ...Object) Object
- func (s *Set) Clear()
- func (s *Set) Contains(key Object) *Bool
- func (s *Set) DelItem(key Object) *Error
- func (s *Set) Difference(other *Set) *Set
- func (s *Set) Equals(other Object) Object
- func (s *Set) GetAttr(name string) (Object, bool)
- func (s *Set) GetItem(key Object) (Object, *Error)
- func (s *Set) GetSlice(slice Slice) (Object, *Error)
- func (s *Set) Inspect() string
- func (s *Set) Interface() interface{}
- func (s *Set) Intersection(other *Set) *Set
- func (s *Set) IsTruthy() bool
- func (s *Set) Iter() Iterator
- func (s *Set) Keys() []HashKey
- func (s *Set) Len() *Int
- func (s *Set) List() *List
- func (s *Set) Remove(items ...Object) Object
- func (s *Set) RunOperation(opType op.BinaryOpType, right Object) Object
- func (s *Set) SetItem(key, value Object) *Error
- func (s *Set) Size() int
- func (s *Set) SortedItems() []Object
- func (s *Set) String() string
- func (s *Set) Type() Type
- func (s *Set) Union(other *Set) *Set
- func (s *Set) Value() map[HashKey]Object
- type SetIter
- func (iter *SetIter) Equals(other Object) Object
- func (iter *SetIter) GetAttr(name string) (Object, bool)
- func (iter *SetIter) Inspect() string
- func (iter *SetIter) Interface() interface{}
- func (iter *SetIter) IsTruthy() bool
- func (iter *SetIter) Next() (IteratorEntry, bool)
- func (iter *SetIter) RunOperation(opType op.BinaryOpType, right Object) Object
- func (iter *SetIter) String() string
- func (iter *SetIter) Type() Type
- type Slice
- type String
- func (s *String) Compare(other Object) (int, error)
- func (s *String) Contains(obj Object) *Bool
- func (s *String) Count(obj Object) Object
- func (s *String) DelItem(key Object) *Error
- func (s *String) Equals(other Object) Object
- func (s *String) Fields() Object
- func (s *String) GetAttr(name string) (Object, bool)
- func (s *String) GetItem(key Object) (Object, *Error)
- func (s *String) GetSlice(slice Slice) (Object, *Error)
- func (s *String) HasPrefix(obj Object) Object
- func (s *String) HasSuffix(obj Object) Object
- func (s *String) HashKey() HashKey
- func (s *String) Index(obj Object) Object
- func (s *String) Inspect() string
- func (s *String) Interface() interface{}
- func (s *String) IsTruthy() bool
- func (s *String) Iter() Iterator
- func (s *String) Join(obj Object) Object
- func (s *String) LastIndex(obj Object) Object
- func (s *String) Len() *Int
- func (s *String) ReplaceAll(old, new Object) Object
- func (s *String) Reversed() *String
- func (s *String) RunOperation(opType op.BinaryOpType, right Object) Object
- func (s *String) Runes() []Object
- func (s *String) SetItem(key, value Object) *Error
- func (s *String) Split(obj Object) Object
- func (s *String) String() string
- func (s *String) ToLower() Object
- func (s *String) ToUpper() Object
- func (s *String) Trim(obj Object) Object
- func (s *String) TrimPrefix(obj Object) Object
- func (s *String) TrimSpace() Object
- func (s *String) TrimSuffix(obj Object) Object
- func (s *String) Type() Type
- func (s *String) Value() string
- type StringConverter
- type StringIter
- func (iter *StringIter) Equals(other Object) Object
- func (iter *StringIter) GetAttr(name string) (Object, bool)
- func (iter *StringIter) Inspect() string
- func (iter *StringIter) Interface() interface{}
- func (iter *StringIter) IsTruthy() bool
- func (iter *StringIter) Next() (IteratorEntry, bool)
- func (iter *StringIter) RunOperation(opType op.BinaryOpType, right Object) Object
- func (iter *StringIter) String() string
- func (iter *StringIter) Type() Type
- type StructConverter
- type Symbol
- type SymbolTable
- func (t *SymbolTable) AccessedNames() []string
- func (t *SymbolTable) Builtins() []Object
- func (t *SymbolTable) Free() []*Resolution
- func (t *SymbolTable) Get(name string) (*Symbol, bool)
- func (t *SymbolTable) InsertBuiltin(name string, value ...Object) (*Symbol, error)
- func (t *SymbolTable) InsertConstant(name string, value ...Object) (*Symbol, error)
- func (t *SymbolTable) InsertVariable(name string, value ...Object) (*Symbol, error)
- func (t *SymbolTable) InsertedNames() []string
- func (t *SymbolTable) IsBuiltin(name string) bool
- func (t *SymbolTable) IsGlobal() bool
- func (t *SymbolTable) IsVariable(name string) bool
- func (t *SymbolTable) LocalTable() *SymbolTable
- func (t *SymbolTable) Lookup(name string) (*Resolution, bool)
- func (t *SymbolTable) NewBlock() *SymbolTable
- func (t *SymbolTable) NewChild() *SymbolTable
- func (t *SymbolTable) Parent() *SymbolTable
- func (t *SymbolTable) Root() *SymbolTable
- func (t *SymbolTable) SetValue(name string, value Object) error
- func (t *SymbolTable) Size() uint16
- func (t *SymbolTable) Variables() []Object
- type Time
- func (t *Time) After(ctx context.Context, args ...Object) Object
- func (t *Time) Before(ctx context.Context, args ...Object) Object
- func (t *Time) Compare(other Object) (int, error)
- func (t *Time) Equals(other Object) Object
- func (t *Time) Format(ctx context.Context, args ...Object) Object
- func (t *Time) GetAttr(name string) (Object, bool)
- func (t *Time) Inspect() string
- func (t *Time) Interface() interface{}
- func (t *Time) IsTruthy() bool
- func (t *Time) RunOperation(opType op.BinaryOpType, right Object) Object
- func (t *Time) String() string
- func (t *Time) Type() Type
- func (t *Time) UTC(ctx context.Context, args ...Object) Object
- func (t *Time) Unix(ctx context.Context, args ...Object) Object
- func (t *Time) Value() time.Time
- type TimeConverter
- type Type
- type TypeConverter
- type TypeRegistryOpts
Constants ¶
const OneMB = 1024 * 1024
Variables ¶
Functions ¶
func CompareTypes ¶
func ResolveIndex ¶
ResolveIndex checks that the index is inbounds and transforms a negative index into the corresponding positive index. If the index is out of bounds, an error is returned.
func ResolveIntSlice ¶
ResolveIntSlice checks that the slice start and stop indices are inbounds and transforms negative indices into the corresponding positive indices. If the slice is out of bounds, an error is returned.
func WithCallFunc ¶
WithCallFunc adds an CallFunc to the context, which can be used by objects to call a Tamarin function at runtime.
func WithCodeFunc ¶
WithCodeFunc adds an CodeFunc to the context, which can be used by objects to retrieve the active code at runtime
Types ¶
type BSlice ¶
type BSlice struct {
// contains filtered or unexported fields
}
func (*BSlice) ContainsAny ¶
func (*BSlice) ContainsRune ¶
func (*BSlice) ReplaceAll ¶
func (*BSlice) RunOperation ¶
func (b *BSlice) RunOperation(opType op.BinaryOpType, right Object) Object
type BSliceIter ¶
type BSliceIter struct {
// contains filtered or unexported fields
}
func NewBytesIter ¶
func NewBytesIter(b *BSlice) *BSliceIter
func (*BSliceIter) Equals ¶
func (iter *BSliceIter) Equals(other Object) Object
func (*BSliceIter) Inspect ¶
func (iter *BSliceIter) Inspect() string
func (*BSliceIter) Interface ¶
func (iter *BSliceIter) Interface() interface{}
func (*BSliceIter) IsTruthy ¶
func (iter *BSliceIter) IsTruthy() bool
func (*BSliceIter) Next ¶
func (iter *BSliceIter) Next() (IteratorEntry, bool)
func (*BSliceIter) RunOperation ¶
func (iter *BSliceIter) RunOperation(opType op.BinaryOpType, right Object) Object
func (*BSliceIter) String ¶
func (iter *BSliceIter) String() string
func (*BSliceIter) Type ¶
func (iter *BSliceIter) Type() Type
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
Bool wraps bool and implements Object and Hashable interface.
func (*Bool) RunOperation ¶
func (b *Bool) RunOperation(opType op.BinaryOpType, right Object) Object
type BooleanConverter ¶
type BooleanConverter struct{}
BooleanConverter converts between bool and Bool.
func (*BooleanConverter) From ¶
func (c *BooleanConverter) From(obj interface{}) (Object, error)
func (*BooleanConverter) To ¶
func (c *BooleanConverter) To(obj Object) (interface{}, error)
func (*BooleanConverter) Type ¶
func (c *BooleanConverter) Type() reflect.Type
type Builtin ¶
type Builtin struct {
// contains filtered or unexported fields
}
Builtin wraps func and implements Object interface.
func NewBuiltin ¶
func NewBuiltin(name string, fn BuiltinFunction, module ...*Module) *Builtin
func NewErrorHandler ¶
func NewErrorHandler(name string, fn BuiltinFunction, module ...*Module) *Builtin
func NewNoopBuiltin ¶
NewNoopBuiltin creates a builtin function that has no effect.
func (*Builtin) IsErrorHandler ¶
func (*Builtin) RunOperation ¶
func (b *Builtin) RunOperation(opType op.BinaryOpType, right Object) Object
func (*Builtin) Value ¶
func (b *Builtin) Value() BuiltinFunction
type BuiltinFunction ¶
BuiltinFunction holds the type of a built-in function.
type BytesConverter ¶
type BytesConverter struct{}
BytesConverter converts between []byte and BSlice.
func (*BytesConverter) From ¶
func (c *BytesConverter) From(obj interface{}) (Object, error)
func (*BytesConverter) To ¶
func (c *BytesConverter) To(obj Object) (interface{}, error)
func (*BytesConverter) Type ¶
func (c *BytesConverter) Type() reflect.Type
type Cell ¶
type Cell struct { *DefaultImpl // contains filtered or unexported fields }
type Code ¶
type Code struct { Name string IsNamed bool Parent *Code Symbols *SymbolTable Instructions []op.Code Constants []Object Loops []*Loop Names []string Source string PipeActive bool }
func (*Code) SymbolCount ¶
type CodeProxy ¶
type CodeProxy struct {
// contains filtered or unexported fields
}
func NewCodeProxy ¶
func (*CodeProxy) RunOperation ¶
func (c *CodeProxy) RunOperation(opType op.BinaryOpType, right Object) Object
type Color ¶
type Color struct {
// contains filtered or unexported fields
}
func (*Color) RunOperation ¶
func (c *Color) RunOperation(opType op.BinaryOpType, right Object) Object
type Comparable ¶
Comparable is an interface used to compare two objects.
-1 if this < other 0 if this == other 1 if this > other
type Container ¶
type Container interface { // GetItem implements the [key] operator for a container type. GetItem(key Object) (Object, *Error) // GetSlice implements the [start:stop] operator for a container type. GetSlice(s Slice) (Object, *Error) // SetItem implements the [key] = value operator for a container type. SetItem(key, value Object) *Error // DelItem implements the del [key] operator for a container type. DelItem(key Object) *Error // Contains returns true if the given item is found in this container. Contains(item Object) *Bool // Len returns the number of items in this container. Len() *Int // Iter returns an iterator for this container. Iter() Iterator }
type ContextConverter ¶
type ContextConverter struct{}
ContextConverter converts between context.Context and Context.
func (*ContextConverter) From ¶
func (c *ContextConverter) From(obj interface{}) (Object, error)
func (*ContextConverter) To ¶
func (c *ContextConverter) To(obj Object) (interface{}, error)
func (*ContextConverter) Type ¶
func (c *ContextConverter) Type() reflect.Type
type DefaultImpl ¶
type DefaultImpl struct{}
func (*DefaultImpl) Equals ¶
func (d *DefaultImpl) Equals(other Object) Object
func (*DefaultImpl) Inspect ¶
func (d *DefaultImpl) Inspect() string
func (*DefaultImpl) Interface ¶
func (d *DefaultImpl) Interface() interface{}
func (*DefaultImpl) IsTruthy ¶
func (d *DefaultImpl) IsTruthy() bool
func (*DefaultImpl) RunOperation ¶
func (d *DefaultImpl) RunOperation(opType op.BinaryOpType, right Object) Object
func (*DefaultImpl) Type ¶
func (d *DefaultImpl) Type() Type
type DefaultTypeRegistry ¶
type DefaultTypeRegistry struct {
// contains filtered or unexported fields
}
DefaultTypeRegistry implements the GoTypeRegistry interface.
func NewTypeRegistry ¶
func NewTypeRegistry(opts ...TypeRegistryOpts) (*DefaultTypeRegistry, error)
NewTypeRegistry creates a GoTypeRegistry that can be used to proxy method calls to various struct types. The provided type conversion functions are used to translate between Go and Tamarin types.
func (*DefaultTypeRegistry) GetAttr ¶
func (p *DefaultTypeRegistry) GetAttr(obj interface{}, name string) (GoAttr, bool)
func (*DefaultTypeRegistry) GetType ¶
func (p *DefaultTypeRegistry) GetType(obj interface{}) (*GoType, bool)
func (*DefaultTypeRegistry) Register ¶
func (p *DefaultTypeRegistry) Register(obj interface{}) (*GoType, error)
type Entry ¶
type Entry struct {
// contains filtered or unexported fields
}
func (*Entry) RunOperation ¶
func (e *Entry) RunOperation(opType op.BinaryOpType, right Object) Object
func (*Entry) WithKeyAsPrimary ¶
func (*Entry) WithValueAsPrimary ¶
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error wraps a Go error interface and implements Object.
func NewArgsError ¶
func NewArgsRangeError ¶
func Sort ¶
Sort a list in place. If the list contains a non-comparable object, an error is returned.
func (*Error) RunOperation ¶
func (e *Error) RunOperation(opType op.BinaryOpType, right Object) Object
type ErrorConverter ¶
type ErrorConverter struct{}
ErrorConverter converts between error and Error.
func (*ErrorConverter) From ¶
func (c *ErrorConverter) From(obj interface{}) (Object, error)
func (*ErrorConverter) To ¶
func (c *ErrorConverter) To(obj Object) (interface{}, error)
func (*ErrorConverter) Type ¶
func (c *ErrorConverter) Type() reflect.Type
type File ¶
type File struct {
// contains filtered or unexported fields
}
func (*File) RunOperation ¶
func (f *File) RunOperation(opType op.BinaryOpType, right Object) Object
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float wraps float64 and implements Object and Hashable interfaces.
func (*Float) RunOperation ¶
func (f *Float) RunOperation(opType op.BinaryOpType, right Object) Object
type Float32Converter ¶
type Float32Converter struct{}
Float32Converter converts between float32 and Float.
func (*Float32Converter) From ¶
func (c *Float32Converter) From(obj interface{}) (Object, error)
func (*Float32Converter) To ¶
func (c *Float32Converter) To(obj Object) (interface{}, error)
func (*Float32Converter) Type ¶
func (c *Float32Converter) Type() reflect.Type
type Float64Converter ¶
type Float64Converter struct{}
Float64Converter converts between float64 and Float.
func (*Float64Converter) From ¶
func (c *Float64Converter) From(obj interface{}) (Object, error)
func (*Float64Converter) To ¶
func (c *Float64Converter) To(obj Object) (interface{}, error)
func (*Float64Converter) Type ¶
func (c *Float64Converter) Type() reflect.Type
type Function ¶
type Function struct { *DefaultImpl // contains filtered or unexported fields }
Function is a function that has been compiled to bytecode.
func NewFunction ¶
func NewFunction(opts FunctionOpts) *Function
func (*Function) Instructions ¶
func (*Function) LocalsCount ¶
func (*Function) Parameters ¶
func (*Function) RequiredArgsCount ¶
type FunctionOpts ¶
type GoAttr ¶
type GoAttr interface { // Name of the attribute. Name() string // Type indicates whether the attribute is a method or a field. AttrType() GoAttrType }
GoAttr is an interface to represent an attribute on a Go type. This could be either a field or a method.
type GoAttrType ¶
type GoAttrType string
GoAttrType is used to indicate whether a GoAttr is a field or a method.
const ( // GoAttrTypeMethod indicates that the GoAttr is a method. GoAttrTypeMethod GoAttrType = "method" // GoAttrTypeField indicates that the GoAttr is a field. GoAttrTypeField GoAttrType = "field" )
type GoField ¶
type GoField struct {
// contains filtered or unexported fields
}
GoField represents a single field on a Go type that can be read or written.
func (*GoField) AttrType ¶
func (f *GoField) AttrType() GoAttrType
func (*GoField) Converter ¶
func (f *GoField) Converter() TypeConverter
type GoMethod ¶
type GoMethod struct {
// contains filtered or unexported fields
}
GoMethod represents a single method on a Go type that can be proxied.
func (*GoMethod) AttrType ¶
func (m *GoMethod) AttrType() GoAttrType
type GoType ¶
type GoType struct {
// contains filtered or unexported fields
}
GoType represents a single Go type whose methods and fields can be proxied.
func (*GoType) StructType ¶
type GoTypeRegistry ¶
type GoTypeRegistry interface { // Register determines type and method information for the provided // object and saves that information for use in later method call proxying. Register(obj interface{}) (*GoType, error) // GetType returns the GoType for the given object and a boolean that // indicates whether the type was found. Only types that were previously // registered will be found. GetType(obj interface{}) (*GoType, bool) // GetAttr returns the GoAttr for the given object and name. GetAttr(obj interface{}, name string) (GoAttr, bool) }
GoTypeRegistry is an interface that defines a way to register Go types and call methods on instances of those types.
type HashKey ¶
type HashKey struct { // Type of the object being referenced. Type Type // FltValue is used as the key for floats. FltValue float64 // IntValue is used as the key for integers. IntValue int64 // StrValue is used as the key for strings. StrValue string }
HashKey is used to identify unique values in a set.
type Hashable ¶
type Hashable interface { // Hash returns a hash key for the given object. HashKey() HashKey }
Hashable types can be hashed and consequently used in a set.
type HttpResponse ¶
type HttpResponse struct {
// contains filtered or unexported fields
}
func NewHttpResponse ¶
func (*HttpResponse) Close ¶
func (r *HttpResponse) Close()
func (*HttpResponse) ContentLength ¶
func (r *HttpResponse) ContentLength() *Int
func (*HttpResponse) Equals ¶
func (r *HttpResponse) Equals(other Object) Object
func (*HttpResponse) Header ¶
func (r *HttpResponse) Header() *Map
func (*HttpResponse) Inspect ¶
func (r *HttpResponse) Inspect() string
func (*HttpResponse) Interface ¶
func (r *HttpResponse) Interface() interface{}
func (*HttpResponse) IsTruthy ¶
func (r *HttpResponse) IsTruthy() bool
func (*HttpResponse) JSON ¶
func (r *HttpResponse) JSON() Object
func (*HttpResponse) Proto ¶
func (r *HttpResponse) Proto() *String
func (*HttpResponse) RunOperation ¶
func (r *HttpResponse) RunOperation(opType op.BinaryOpType, right Object) Object
func (*HttpResponse) Status ¶
func (r *HttpResponse) Status() *String
func (*HttpResponse) StatusCode ¶
func (r *HttpResponse) StatusCode() *Int
func (*HttpResponse) Text ¶
func (r *HttpResponse) Text() Object
func (*HttpResponse) Type ¶
func (r *HttpResponse) Type() Type
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
func (*Image) RunOperation ¶
func (img *Image) RunOperation(opType op.BinaryOpType, right Object) Object
type Int ¶
type Int struct {
// contains filtered or unexported fields
}
Int wraps int64 and implements Object and Hashable interfaces.
func (*Int) RunOperation ¶
func (i *Int) RunOperation(opType op.BinaryOpType, right Object) Object
type Int64Converter ¶
type Int64Converter struct{}
Int64Converter converts between int64 and Integer.
func (*Int64Converter) From ¶
func (c *Int64Converter) From(obj interface{}) (Object, error)
func (*Int64Converter) To ¶
func (c *Int64Converter) To(obj Object) (interface{}, error)
func (*Int64Converter) Type ¶
func (c *Int64Converter) Type() reflect.Type
type IntConverter ¶
type IntConverter struct{}
IntConverter converts between int and Integer.
func (*IntConverter) From ¶
func (c *IntConverter) From(obj interface{}) (Object, error)
func (*IntConverter) To ¶
func (c *IntConverter) To(obj Object) (interface{}, error)
func (*IntConverter) Type ¶
func (c *IntConverter) Type() reflect.Type
type Iterator ¶
type Iterator interface { Object // Next returns the next item in the iterator and a bool indicating whether // the returned item is valid. If the iteration is complete, (nil, false) is // returned. Next() (IteratorEntry, bool) }
Iterator is an interface used to iterate over a container.
type IteratorEntry ¶
IteratorEntry is a single item returned by an iterator.
type List ¶
type List struct {
// contains filtered or unexported fields
}
List of objects
func NewStringList ¶
func (*List) RunOperation ¶
func (ls *List) RunOperation(opType op.BinaryOpType, right Object) Object
type ListIter ¶
type ListIter struct {
// contains filtered or unexported fields
}
func NewListIter ¶
func (*ListIter) Next ¶
func (iter *ListIter) Next() (IteratorEntry, bool)
func (*ListIter) RunOperation ¶
func (iter *ListIter) RunOperation(opType op.BinaryOpType, right Object) Object
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
func NewMapFromGo ¶
func (*Map) GetWithObject ¶
func (*Map) RunOperation ¶
func (m *Map) RunOperation(opType op.BinaryOpType, right Object) Object
func (*Map) SortedKeys ¶
func (*Map) StringKeys ¶
type MapIter ¶
type MapIter struct {
// contains filtered or unexported fields
}
func NewMapIter ¶
func (*MapIter) Next ¶
func (iter *MapIter) Next() (IteratorEntry, bool)
func (*MapIter) RunOperation ¶
func (iter *MapIter) RunOperation(opType op.BinaryOpType, right Object) Object
type MapStringIfaceConverter ¶
type MapStringIfaceConverter struct{}
MapStringIfaceConverter converts between map[string]interface{} and Hash.
func (*MapStringIfaceConverter) From ¶
func (c *MapStringIfaceConverter) From(obj interface{}) (Object, error)
func (*MapStringIfaceConverter) To ¶
func (c *MapStringIfaceConverter) To(obj Object) (interface{}, error)
func (*MapStringIfaceConverter) Type ¶
func (c *MapStringIfaceConverter) Type() reflect.Type
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func (*Module) RunOperation ¶
func (m *Module) RunOperation(opType op.BinaryOpType, right Object) Object
type NilType ¶
type NilType struct{}
func (*NilType) RunOperation ¶
func (n *NilType) RunOperation(opType op.BinaryOpType, right Object) Object
type Object ¶
type Object interface { // Type of the object. Type() Type // Inspect returns a string representation of the given object. Inspect() string // Interface converts the given object to a native Go value. Interface() interface{} // Returns True if the given object is equal to this object. Equals(other Object) Object // GetAttr returns the attribute with the given name from this object. GetAttr(name string) (Object, bool) // IsTruthy returns true if the object is considered "truthy". IsTruthy() bool // RunOperation runs an operation on this object with the given // right-hand side object. RunOperation(opType op.BinaryOpType, right Object) Object }
Object is the interface that all object types in Tamarin must implement.
func BinaryOp ¶
func BinaryOp(opType op.BinaryOpType, a, b Object) Object
BinaryOp performs a binary operation on two objects, given an operator.
func Compare ¶
func Compare(opType op.CompareOpType, a, b Object) Object
Compare two objects using the given comparison operator. An Error object is returned if either of the objects is not comparable.
func FromGoType ¶
func FromGoType(obj interface{}) Object
type Partial ¶
type Partial struct {
// contains filtered or unexported fields
}
Partial is a partially applied function
func NewPartial ¶
func (*Partial) RunOperation ¶
func (f *Partial) RunOperation(opType op.BinaryOpType, right Object) Object
type Proxy ¶
type Proxy struct {
// contains filtered or unexported fields
}
Proxy is a Tamarin type that proxies method calls to a wrapped Go struct. Only the public methods of the Go type are proxied.
func NewProxy ¶
func NewProxy(reg GoTypeRegistry, obj interface{}) (*Proxy, error)
NewProxy returns a new Tamarin proxy object that wraps the given Go object. The Go type is registered with the type registry, which has no effect if the type is already registered. This operation may fail if the Go type has attributes whose types cannot be converted to Tamarin types.
func (*Proxy) RunOperation ¶
func (p *Proxy) RunOperation(opType op.BinaryOpType, right Object) Object
type Resolution ¶
func (*Resolution) String ¶
func (r *Resolution) String() string
type Result ¶
type Result struct {
// contains filtered or unexported fields
}
Result contains one of: an "ok" value or an "err" value
func NewErrResult ¶
func NewOkResult ¶
func (*Result) RunOperation ¶
func (rv *Result) RunOperation(opType op.BinaryOpType, right Object) Object
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
func NewSetWithSize ¶
func (*Set) Difference ¶
Difference returns a new set that is the difference of the two sets.
func (*Set) Intersection ¶
Intersection returns a new set that is the intersection of the two sets.
func (*Set) RunOperation ¶
func (s *Set) RunOperation(opType op.BinaryOpType, right Object) Object
func (*Set) SortedItems ¶
type SetIter ¶
type SetIter struct {
// contains filtered or unexported fields
}
func NewSetIter ¶
func (*SetIter) Next ¶
func (iter *SetIter) Next() (IteratorEntry, bool)
func (*SetIter) RunOperation ¶
func (iter *SetIter) RunOperation(opType op.BinaryOpType, right Object) Object
type String ¶
type String struct {
// contains filtered or unexported fields
}
func (*String) ReplaceAll ¶
func (*String) RunOperation ¶
func (s *String) RunOperation(opType op.BinaryOpType, right Object) Object
func (*String) TrimPrefix ¶
func (*String) TrimSuffix ¶
type StringConverter ¶
type StringConverter struct{}
StringConverter converts between string and String.
func (*StringConverter) From ¶
func (c *StringConverter) From(obj interface{}) (Object, error)
func (*StringConverter) To ¶
func (c *StringConverter) To(obj Object) (interface{}, error)
func (*StringConverter) Type ¶
func (c *StringConverter) Type() reflect.Type
type StringIter ¶
type StringIter struct {
// contains filtered or unexported fields
}
func NewStringIter ¶
func NewStringIter(s *String) *StringIter
func (*StringIter) Equals ¶
func (iter *StringIter) Equals(other Object) Object
func (*StringIter) Inspect ¶
func (iter *StringIter) Inspect() string
func (*StringIter) Interface ¶
func (iter *StringIter) Interface() interface{}
func (*StringIter) IsTruthy ¶
func (iter *StringIter) IsTruthy() bool
func (*StringIter) Next ¶
func (iter *StringIter) Next() (IteratorEntry, bool)
func (*StringIter) RunOperation ¶
func (iter *StringIter) RunOperation(opType op.BinaryOpType, right Object) Object
func (*StringIter) String ¶
func (iter *StringIter) String() string
func (*StringIter) Type ¶
func (iter *StringIter) Type() Type
type StructConverter ¶
type StructConverter struct { Prototype interface{} AsPointer bool }
StructConverter converts between a struct and a Map via JSON marshaling.
func (*StructConverter) From ¶
func (c *StructConverter) From(obj interface{}) (Object, error)
func (*StructConverter) To ¶
func (c *StructConverter) To(obj Object) (interface{}, error)
func (*StructConverter) Type ¶
func (c *StructConverter) Type() reflect.Type
type SymbolTable ¶
type SymbolTable struct {
// contains filtered or unexported fields
}
func NewSymbolTable ¶
func NewSymbolTable() *SymbolTable
func (*SymbolTable) AccessedNames ¶
func (t *SymbolTable) AccessedNames() []string
func (*SymbolTable) Builtins ¶
func (t *SymbolTable) Builtins() []Object
func (*SymbolTable) Free ¶
func (t *SymbolTable) Free() []*Resolution
func (*SymbolTable) InsertBuiltin ¶
func (t *SymbolTable) InsertBuiltin(name string, value ...Object) (*Symbol, error)
func (*SymbolTable) InsertConstant ¶
func (t *SymbolTable) InsertConstant(name string, value ...Object) (*Symbol, error)
func (*SymbolTable) InsertVariable ¶
func (t *SymbolTable) InsertVariable(name string, value ...Object) (*Symbol, error)
func (*SymbolTable) InsertedNames ¶
func (t *SymbolTable) InsertedNames() []string
func (*SymbolTable) IsBuiltin ¶
func (t *SymbolTable) IsBuiltin(name string) bool
func (*SymbolTable) IsGlobal ¶
func (t *SymbolTable) IsGlobal() bool
func (*SymbolTable) IsVariable ¶
func (t *SymbolTable) IsVariable(name string) bool
func (*SymbolTable) LocalTable ¶
func (t *SymbolTable) LocalTable() *SymbolTable
func (*SymbolTable) Lookup ¶
func (t *SymbolTable) Lookup(name string) (*Resolution, bool)
func (*SymbolTable) NewBlock ¶
func (t *SymbolTable) NewBlock() *SymbolTable
func (*SymbolTable) NewChild ¶
func (t *SymbolTable) NewChild() *SymbolTable
func (*SymbolTable) Parent ¶
func (t *SymbolTable) Parent() *SymbolTable
func (*SymbolTable) Root ¶
func (t *SymbolTable) Root() *SymbolTable
func (*SymbolTable) Size ¶
func (t *SymbolTable) Size() uint16
func (*SymbolTable) Variables ¶
func (t *SymbolTable) Variables() []Object
type Time ¶
type Time struct {
// contains filtered or unexported fields
}
func (*Time) RunOperation ¶
func (t *Time) RunOperation(opType op.BinaryOpType, right Object) Object
type TimeConverter ¶
type TimeConverter struct{}
TimeConverter converts between time.Time and Time.
func (*TimeConverter) From ¶
func (c *TimeConverter) From(obj interface{}) (Object, error)
func (*TimeConverter) To ¶
func (c *TimeConverter) To(obj Object) (interface{}, error)
func (*TimeConverter) Type ¶
func (c *TimeConverter) Type() reflect.Type
type Type ¶
type Type string
Type of an object as a string.
const ( BOOL Type = "bool" BUILTIN Type = "builtin" BSLICE Type = "bslice" BSLICE_ITER Type = "bslice_iter" CELL Type = "cell" CODE Type = "code" COLOR Type = "color" ERROR Type = "error" FILE Type = "file" FLOAT Type = "float" FUNCTION Type = "function" HTTP_RESPONSE Type = "http_response" IMAGE Type = "image" INT Type = "int" ITER_ENTRY Type = "iter_entry" LIST Type = "list" LIST_ITER Type = "list_iter" MAP Type = "map" MAP_ITER Type = "map_iter" MODULE Type = "module" NIL Type = "nil" PARTIAL Type = "partial" PROXY Type = "proxy" REGEXP Type = "regexp" RESULT Type = "result" SET Type = "set" SET_ITER Type = "set_iter" STRING Type = "string" STRING_ITER Type = "string_iter" TIME Type = "time" )
Type constants
type TypeConverter ¶
type TypeConverter interface { // To converts a Tamarin object to a Go object. To(Object) (interface{}, error) // From converts a Go object to a Tamarin object. From(interface{}) (Object, error) // Type that this TypeConverter is responsible for. Type() reflect.Type }
TypeConverter is an interface used to convert between Go and Tamarin objects for a single Go type. There may be a way to use generics here...
type TypeRegistryOpts ¶
type TypeRegistryOpts struct { // Converters is a list of TypeConverters that will be used to convert // input and output types for method calls. Converters []TypeConverter // NoDefaults indicates that the default TypeConverters should not be // automatically used by the registry. If this is set, the caller should // provide their own TypeConverters. NoDefaults bool }
TypeRegistryOpts contains options used to create a GoTypeRegistry.
Source Files ¶
- bool.go
- bslice.go
- bslice_iter.go
- builtin.go
- cell.go
- code.go
- code_proxy.go
- color.go
- context_values.go
- default.go
- error.go
- errors.go
- file.go
- float.go
- function.go
- http_response.go
- image.go
- int.go
- iter_entry.go
- list.go
- list_iter.go
- map.go
- map_iter.go
- module.go
- nil.go
- object.go
- operations.go
- partial.go
- proxy.go
- result.go
- set.go
- set_iter.go
- sort.go
- string.go
- string_iter.go
- symbol_table.go
- time.go
- typeconv.go