Documentation
¶
Overview ¶
Package object defines all available object types in Tamarin.
For external users of Tamarin, most 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 IsError(obj Object) bool
- func IsTruthy(obj Object) bool
- func ToGoType(obj Object) interface{}
- func WithCallFunc(ctx context.Context, fn CallFunc) context.Context
- 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() Key
- func (b *Bool) Inspect() string
- func (b *Bool) String() string
- func (b *Bool) ToInterface() interface{}
- func (b *Bool) Type() Type
- type BooleanConverter
- type BreakValue
- type Builtin
- type BuiltinFunction
- type CallFunc
- type Comparable
- type ContextConverter
- type DatabaseConnection
- type DefaultTypeRegistry
- type Error
- func AsFloat(obj Object) (float64, *Error)
- func AsInteger(obj Object) (int64, *Error)
- func AsString(obj Object) (result string, err *Error)
- func AsTime(obj Object) (result time.Time, err *Error)
- func NewArgsError(fn string, takes, given int) *Error
- func NewArgsRangeError(fn string, takesMin, takesMax, given int) *Error
- func NewError(format string, a ...interface{}) *Error
- func Sort(items []Object) *Error
- type ErrorConverter
- 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() Key
- func (f *Float) Inspect() string
- func (f *Float) String() string
- func (f *Float) ToInterface() interface{}
- func (f *Float) Type() Type
- type Float32Converter
- type Float64Converter
- type Function
- 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 Hashable
- type HttpResponse
- func (r *HttpResponse) Equals(other Object) Object
- func (r *HttpResponse) GetAttr(name string) (Object, bool)
- func (r *HttpResponse) Inspect() string
- func (r *HttpResponse) JSON() (target interface{}, err error)
- func (r *HttpResponse) Text() (string, error)
- func (r *HttpResponse) ToInterface() interface{}
- func (r *HttpResponse) Type() Type
- type Int
- type Int64Converter
- type IntConverter
- type Key
- type List
- func (ls *List) Append(obj Object)
- func (ls *List) Clear()
- func (ls *List) Compare(other Object) (int, error)
- func (ls *List) Copy() *List
- func (ls *List) Count(obj Object) int64
- 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) Index(obj Object) int64
- func (ls *List) Insert(index int64, obj Object)
- func (ls *List) Inspect() string
- func (ls *List) Keys() Object
- 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) String() string
- func (ls *List) ToInterface() interface{}
- func (ls *List) Type() Type
- type Map
- func (m *Map) Clear()
- func (m *Map) Contains(key string) Object
- func (m *Map) Copy() *Map
- 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) GetWithObject(key *String) Object
- func (m *Map) Inspect() string
- func (m *Map) Keys() *List
- func (m *Map) ListItems() *List
- func (m *Map) Pop(key string, def Object) Object
- func (m *Map) Set(key string, value Object)
- func (m *Map) SetDefault(key string, value Object) Object
- func (m *Map) Size() int
- func (m *Map) SortedKeys() []string
- func (m *Map) ToInterface() interface{}
- func (m *Map) Type() Type
- func (m *Map) Update(other *Map)
- func (m *Map) Values() *List
- type MapStringIfaceConverter
- type Module
- type NilType
- type Object
- type Proxy
- type Regexp
- type Result
- func (rv *Result) Equals(other Object) Object
- func (rv *Result) Expect(other Object) Object
- func (rv *Result) GetAttr(name string) (Object, bool)
- func (rv *Result) Inspect() string
- func (rv *Result) IsErr() bool
- func (rv *Result) IsOk() bool
- func (rv *Result) String() string
- func (rv *Result) ToInterface() interface{}
- func (rv *Result) Type() Type
- func (rv *Result) Unwrap() Object
- func (rv *Result) UnwrapOr(other Object) Object
- type ReturnValue
- type Scope
- type Set
- func (s *Set) Add(items ...Object) error
- func (s *Set) Contains(item Object) bool
- 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) Inspect() string
- func (s *Set) Intersection(other *Set) *Set
- func (s *Set) List() *List
- func (s *Set) Remove(items ...Object) error
- func (s *Set) Size() int
- func (s *Set) SortedItems() []Object
- func (s *Set) ToInterface() interface{}
- func (s *Set) Type() Type
- func (s *Set) Union(other *Set) *Set
- type String
- func (s *String) Compare(other Object) (int, error)
- func (s *String) Equals(other Object) Object
- func (s *String) GetAttr(name string) (Object, bool)
- func (s *String) HashKey() Key
- func (s *String) Inspect() string
- func (s *String) Reversed() *String
- func (s *String) String() string
- func (s *String) ToInterface() interface{}
- func (s *String) Type() Type
- type StringConverter
- type StructConverter
- type Time
- type TimeConverter
- type Type
- type TypeConverter
- type TypeRegistryOpts
Constants ¶
const ( INT = "int" FLOAT = "float" BOOL = "bool" NIL = "nil" ERROR = "error" FUNCTION = "function" STRING = "string" BUILTIN = "builtin" LIST = "list" MAP = "map" FILE = "file" REGEXP = "regexp" SET = "set" MODULE = "module" RESULT = "result" HTTP_RESPONSE = "http_response" DB_CONNECTION = "db_connection" TIME = "time" PROXY = "proxy" RETURN_VALUE = "return_value" BREAK_VALUE = "break_value" )
Type constants
Variables ¶
Functions ¶
func CompareTypes ¶ added in v0.0.9
Types ¶
type Bool ¶ added in v0.0.11
type Bool struct {
// Value holds the boolean value we wrap.
Value bool
}
Bool wraps bool and implements Object and Hashable interface.
func (*Bool) ToInterface ¶ added in v0.0.11
func (b *Bool) ToInterface() interface{}
type BooleanConverter ¶ added in v0.0.9
type BooleanConverter struct{}
BooleanConverter converts between bool and Bool.
func (*BooleanConverter) From ¶ added in v0.0.9
func (c *BooleanConverter) From(obj interface{}) (Object, error)
func (*BooleanConverter) To ¶ added in v0.0.9
func (c *BooleanConverter) To(obj Object) (interface{}, error)
func (*BooleanConverter) Type ¶ added in v0.0.9
func (c *BooleanConverter) Type() reflect.Type
type BreakValue ¶ added in v0.0.6
type BreakValue struct{}
BreakValue is an implementation detail used to handle break statements
func (*BreakValue) Equals ¶ added in v0.0.12
func (rv *BreakValue) Equals(other Object) Object
func (*BreakValue) GetAttr ¶ added in v0.0.12
func (rv *BreakValue) GetAttr(name string) (Object, bool)
func (*BreakValue) Inspect ¶ added in v0.0.6
func (rv *BreakValue) Inspect() string
func (*BreakValue) ToInterface ¶ added in v0.0.6
func (rv *BreakValue) ToInterface() interface{}
func (*BreakValue) Type ¶ added in v0.0.6
func (rv *BreakValue) Type() Type
type Builtin ¶
type Builtin struct {
// The function that this object wraps.
Fn BuiltinFunction
// The name of the function.
Name string
// The module the function originates from (optional)
Module *Module
// The name of the module this function origiantes from.
// This is only used for overriding builtins.
ModuleName string
}
Builtin wraps func and implements Object interface.
func NewNoopBuiltin ¶ added in v0.0.6
NewNoopBuiltin creates a builtin function that has no effect.
func (*Builtin) Key ¶ added in v0.0.6
Returns a string that uniquely identifies this builtin function.
func (*Builtin) ToInterface ¶
func (b *Builtin) ToInterface() interface{}
ToInterface converts this object to a go-interface, which will allow it to be used naturally in our sprintf/printf primitives.
It might also be helpful for embedded users.
type BuiltinFunction ¶
BuiltinFunction holds the type of a built-in function.
type CallFunc ¶ added in v0.0.12
CallFunc defines a type signature for a function that can call a Tamarin function. In part, this type definition is useful to avoid a circular dependency with the evaluator package.
type Comparable ¶ added in v0.0.9
Comparable is an interface used to compare two objects.
-1 if this < other 0 if this == other 1 if this > other
type ContextConverter ¶ added in v0.0.12
type ContextConverter struct{}
ContextConverter converts between context.Context and Context.
func (*ContextConverter) From ¶ added in v0.0.12
func (c *ContextConverter) From(obj interface{}) (Object, error)
func (*ContextConverter) To ¶ added in v0.0.12
func (c *ContextConverter) To(obj Object) (interface{}, error)
func (*ContextConverter) Type ¶ added in v0.0.12
func (c *ContextConverter) Type() reflect.Type
type DatabaseConnection ¶
type DatabaseConnection struct {
Conn interface{}
}
func (*DatabaseConnection) Equals ¶ added in v0.0.12
func (c *DatabaseConnection) Equals(other Object) Object
func (*DatabaseConnection) GetAttr ¶ added in v0.0.12
func (c *DatabaseConnection) GetAttr(name string) (Object, bool)
func (*DatabaseConnection) Inspect ¶
func (c *DatabaseConnection) Inspect() string
func (*DatabaseConnection) ToInterface ¶
func (c *DatabaseConnection) ToInterface() interface{}
func (*DatabaseConnection) Type ¶
func (c *DatabaseConnection) Type() Type
type DefaultTypeRegistry ¶ added in v0.0.12
type DefaultTypeRegistry struct {
// contains filtered or unexported fields
}
DefaultTypeRegistry implements the GoTypeRegistry interface.
func NewTypeRegistry ¶ added in v0.0.12
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 ¶ added in v0.0.12
func (p *DefaultTypeRegistry) GetAttr(obj interface{}, name string) (GoAttr, bool)
func (*DefaultTypeRegistry) GetType ¶ added in v0.0.12
func (p *DefaultTypeRegistry) GetType(obj interface{}) (*GoType, bool)
func (*DefaultTypeRegistry) Register ¶ added in v0.0.12
func (p *DefaultTypeRegistry) Register(obj interface{}) (*GoType, error)
type Error ¶
type Error struct {
// Message contains the error-message we're wrapping
Message string
}
Error wraps string and implements Object interface.
func NewArgsError ¶ added in v0.0.12
func NewArgsRangeError ¶ added in v0.0.12
func Sort ¶ added in v0.0.12
Sort a list in place. If the list contains a non-comparable object, an error is returned.
func (*Error) ToInterface ¶
func (e *Error) ToInterface() interface{}
type ErrorConverter ¶ added in v0.0.9
type ErrorConverter struct{}
func (*ErrorConverter) From ¶ added in v0.0.9
func (c *ErrorConverter) From(obj interface{}) (Object, error)
func (*ErrorConverter) To ¶ added in v0.0.9
func (c *ErrorConverter) To(obj Object) (interface{}, error)
func (*ErrorConverter) Type ¶ added in v0.0.9
func (c *ErrorConverter) Type() reflect.Type
type Float ¶
type Float struct {
// Value holds the float64 wrapped by this object.
Value float64
}
Float wraps float64 and implements Object and Hashable interfaces.
func (*Float) ToInterface ¶
func (f *Float) ToInterface() interface{}
type Float32Converter ¶ added in v0.0.9
type Float32Converter struct{}
Float32Converter converts between float32 and Float.
func (*Float32Converter) From ¶ added in v0.0.9
func (c *Float32Converter) From(obj interface{}) (Object, error)
func (*Float32Converter) To ¶ added in v0.0.9
func (c *Float32Converter) To(obj Object) (interface{}, error)
func (*Float32Converter) Type ¶ added in v0.0.9
func (c *Float32Converter) Type() reflect.Type
type Float64Converter ¶ added in v0.0.9
type Float64Converter struct{}
Float64Converter converts between float64 and Float.
func (*Float64Converter) From ¶ added in v0.0.9
func (c *Float64Converter) From(obj interface{}) (Object, error)
func (*Float64Converter) To ¶ added in v0.0.9
func (c *Float64Converter) To(obj Object) (interface{}, error)
func (*Float64Converter) Type ¶ added in v0.0.9
func (c *Float64Converter) Type() reflect.Type
type Function ¶
type Function struct {
Parameters []*ast.Identifier
Body *ast.BlockStatement
Defaults map[string]ast.Expression
Scope interface{} // avoids circular package dependency; is a scope.Scope
}
Function wraps ast.Identifier array and ast.BlockStatement and implements Object interface.
func (*Function) ToInterface ¶
func (f *Function) ToInterface() interface{}
type GoAttr ¶ added in v0.0.12
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 ¶ added in v0.0.12
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 ¶ added in v0.0.12
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 ¶ added in v0.0.12
func (f *GoField) AttrType() GoAttrType
func (*GoField) Converter ¶ added in v0.0.12
func (f *GoField) Converter() TypeConverter
type GoMethod ¶ added in v0.0.12
type GoMethod struct {
// contains filtered or unexported fields
}
GoMethod represents a single method on a Go type that can be proxied.
func (*GoMethod) AttrType ¶ added in v0.0.12
func (m *GoMethod) AttrType() GoAttrType
type GoType ¶ added in v0.0.12
type GoType struct {
// contains filtered or unexported fields
}
GoType represents a single Go type whose methods and fields can be proxied.
func (*GoType) AttrByName ¶ added in v0.0.12
func (*GoType) FieldByName ¶ added in v0.0.12
func (*GoType) MethodByName ¶ added in v0.0.12
func (*GoType) StructType ¶ added in v0.0.12
type GoTypeRegistry ¶ added in v0.0.12
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 Hashable ¶
type Hashable interface {
// HashKey returns a hash key for the given object.
HashKey() Key
}
Hashable types can be hashed and consequently used in a set.
type HttpResponse ¶
func (*HttpResponse) Equals ¶ added in v0.0.12
func (r *HttpResponse) Equals(other Object) Object
func (*HttpResponse) GetAttr ¶ added in v0.0.12
func (r *HttpResponse) GetAttr(name string) (Object, bool)
func (*HttpResponse) Inspect ¶
func (r *HttpResponse) Inspect() string
func (*HttpResponse) JSON ¶
func (r *HttpResponse) JSON() (target interface{}, err error)
func (*HttpResponse) Text ¶
func (r *HttpResponse) Text() (string, error)
func (*HttpResponse) ToInterface ¶
func (r *HttpResponse) ToInterface() interface{}
func (*HttpResponse) Type ¶
func (r *HttpResponse) Type() Type
type Int ¶ added in v0.0.11
type Int struct {
// Value holds the int64 wrapped by this object.
Value int64
}
Int wraps int64 and implements Object and Hashable interfaces.
func (*Int) ToInterface ¶ added in v0.0.11
func (i *Int) ToInterface() interface{}
type Int64Converter ¶ added in v0.0.9
type Int64Converter struct{}
Int64Converter converts between int64 and Integer.
func (*Int64Converter) From ¶ added in v0.0.9
func (c *Int64Converter) From(obj interface{}) (Object, error)
func (*Int64Converter) To ¶ added in v0.0.9
func (c *Int64Converter) To(obj Object) (interface{}, error)
func (*Int64Converter) Type ¶ added in v0.0.9
func (c *Int64Converter) Type() reflect.Type
type IntConverter ¶ added in v0.0.9
type IntConverter struct{}
IntConverter converts between int and Integer.
func (*IntConverter) From ¶ added in v0.0.9
func (c *IntConverter) From(obj interface{}) (Object, error)
func (*IntConverter) To ¶ added in v0.0.9
func (c *IntConverter) To(obj Object) (interface{}, error)
func (*IntConverter) Type ¶ added in v0.0.9
func (c *IntConverter) Type() reflect.Type
type Key ¶ added in v0.0.9
type Key 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
}
Key is used to identify unique values in a set.
type List ¶ added in v0.0.10
type List struct {
// Items holds the list of objects
Items []Object
}
List of objects
func NewStringList ¶ added in v0.0.10
func (*List) Clear ¶ added in v0.0.12
func (ls *List) Clear()
Clear removes all the items from the list.
func (*List) Extend ¶ added in v0.0.12
Extend adds the items of a list to the end of the current list.
func (*List) Index ¶ added in v0.0.12
Index returns the index of the first item with the specified value.
func (*List) Reverse ¶ added in v0.0.12
func (ls *List) Reverse()
Reverse reverses the order of the list.
func (*List) ToInterface ¶ added in v0.0.10
func (ls *List) ToInterface() interface{}
type Map ¶ added in v0.0.11
func (*Map) GetWithObject ¶ added in v0.0.11
func (*Map) SortedKeys ¶ added in v0.0.12
func (*Map) ToInterface ¶ added in v0.0.11
func (m *Map) ToInterface() interface{}
type MapStringIfaceConverter ¶ added in v0.0.9
type MapStringIfaceConverter struct{}
MapStringIfaceConverter converts between map[string]interface{} and Hash.
func (*MapStringIfaceConverter) From ¶ added in v0.0.9
func (c *MapStringIfaceConverter) From(obj interface{}) (Object, error)
func (*MapStringIfaceConverter) To ¶ added in v0.0.9
func (c *MapStringIfaceConverter) To(obj Object) (interface{}, error)
func (*MapStringIfaceConverter) Type ¶ added in v0.0.9
func (c *MapStringIfaceConverter) Type() reflect.Type
type Module ¶
func (*Module) ToInterface ¶
func (m *Module) ToInterface() interface{}
type NilType ¶ added in v0.0.11
type NilType struct{}
func (*NilType) ToInterface ¶ added in v0.0.11
func (n *NilType) ToInterface() interface{}
type Object ¶
type Object interface {
// Type of this object.
Type() Type
// Inspect returns a string-representation of the given object.
Inspect() string
// ToInterface converts the given object to a "native" golang value,
// which is required to ensure that we can use the object in our
// `sprintf` or `printf` primitives.
ToInterface() 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)
}
Object is the interface that all object types in Tamarin must implement.
func FromGoType ¶
func FromGoType(obj interface{}) Object
type Proxy ¶ added in v0.0.9
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 ¶ added in v0.0.9
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) ToInterface ¶ added in v0.0.9
func (p *Proxy) ToInterface() interface{}
type Regexp ¶
type Regexp struct {
// Value holds the string value this object wraps.
Value string
// Flags holds the flags for the object
Flags string
}
Regexp wraps regular-expressions and implements the Object interface.
func (*Regexp) ToInterface ¶
func (r *Regexp) ToInterface() interface{}
type Result ¶
Result contains one of: an "ok" value or an "err" value
func NewErrorResult ¶
func NewOkResult ¶ added in v0.0.4
func (*Result) ToInterface ¶
func (rv *Result) ToInterface() interface{}
type ReturnValue ¶
type ReturnValue struct {
// Value is the object that is to be returned
Value Object
}
ReturnValue wraps Object and implements Object interface.
func (*ReturnValue) Equals ¶ added in v0.0.12
func (rv *ReturnValue) Equals(other Object) Object
func (*ReturnValue) GetAttr ¶ added in v0.0.12
func (rv *ReturnValue) GetAttr(name string) (Object, bool)
func (*ReturnValue) Inspect ¶
func (rv *ReturnValue) Inspect() string
func (*ReturnValue) ToInterface ¶
func (rv *ReturnValue) ToInterface() interface{}
func (*ReturnValue) Type ¶
func (rv *ReturnValue) Type() Type
type Scope ¶ added in v0.0.12
type Scope interface {
// Name of the scope, to aid debugging
Name() string
// IsReadOnly returns true iff the scope contains a variable with the
// given name and that variable is marked as read-only.
IsReadOnly(name string) bool
// Get returns the object associated with the given name, and a boolean
// indicating whether the object was found.
Get(name string) (Object, bool)
// Declare adds a new variable to the scope. If the variable already
// exists, an error is returned.
Declare(name string, obj Object, readOnly bool) error
// Update the variable with the given name. If the variable does not
// exist, an error is returned.
Update(name string, obj Object) error
// Contents returns a map of all variables in the scope.
Contents() map[string]Object
}
Scope is an interface that can be used to implement variable storage for a specific context.
type Set ¶
func NewSetWithSize ¶ added in v0.0.9
func (*Set) Difference ¶ added in v0.0.9
Difference returns a new set that is the difference of the two sets.
func (*Set) Intersection ¶ added in v0.0.9
Intersection returns a new set that is the intersection of the two sets.
func (*Set) SortedItems ¶ added in v0.0.12
func (*Set) ToInterface ¶
func (s *Set) ToInterface() interface{}
type String ¶
type String struct {
// Value holds the string wrapped by this object.
Value string
}
String wraps string and implements Object and Hashable interfaces.
func (*String) ToInterface ¶
func (s *String) ToInterface() interface{}
type StringConverter ¶ added in v0.0.9
type StringConverter struct{}
StringConverter converts between string and String.
func (*StringConverter) From ¶ added in v0.0.9
func (c *StringConverter) From(obj interface{}) (Object, error)
func (*StringConverter) To ¶ added in v0.0.9
func (c *StringConverter) To(obj Object) (interface{}, error)
func (*StringConverter) Type ¶ added in v0.0.9
func (c *StringConverter) Type() reflect.Type
type StructConverter ¶ added in v0.0.9
type StructConverter struct {
Prototype interface{}
AsPointer bool
}
StructConverter converts between a struct and a Hash via JSON marshaling.
func (*StructConverter) From ¶ added in v0.0.9
func (c *StructConverter) From(obj interface{}) (Object, error)
func (*StructConverter) To ¶ added in v0.0.9
func (c *StructConverter) To(obj Object) (interface{}, error)
func (*StructConverter) Type ¶ added in v0.0.9
func (c *StructConverter) Type() reflect.Type
type Time ¶ added in v0.0.4
func (*Time) ToInterface ¶ added in v0.0.4
func (t *Time) ToInterface() interface{}
type TimeConverter ¶ added in v0.0.9
type TimeConverter struct{}
TimeConverter converts between time.Time and Time.
func (*TimeConverter) From ¶ added in v0.0.9
func (c *TimeConverter) From(obj interface{}) (Object, error)
func (*TimeConverter) To ¶ added in v0.0.9
func (c *TimeConverter) To(obj Object) (interface{}, error)
func (*TimeConverter) Type ¶ added in v0.0.9
func (c *TimeConverter) Type() reflect.Type
type TypeConverter ¶ added in v0.0.9
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 ¶ added in v0.0.12
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.