Documentation ¶
Index ¶
- func CoerceToAny(val interface{}) (interface{}, error)
- func CoerceToArray(val interface{}) ([]interface{}, error)
- func CoerceToArrayIfNecessary(val interface{}) (interface{}, error)
- func CoerceToBoolean(val interface{}) (bool, error)
- func CoerceToDouble(val interface{}) (float64, error)
- func CoerceToInteger(val interface{}) (int, error)
- func CoerceToLong(val interface{}) (int64, error)
- func CoerceToNumber(val interface{}) (float64, error)deprecated
- func CoerceToObject(val interface{}) (map[string]interface{}, error)
- func CoerceToParams(val interface{}) (map[string]string, error)
- func CoerceToString(val interface{}) (string, error)
- func CoerceToValue(value interface{}, dataType Type) (interface{}, error)
- func GetValueWithResolver(valueMap map[string]interface{}, key string) (interface{}, bool)
- func IsSimpleType(val interface{}) bool
- func PathDeconstruct(fullPath string) (attrName string, path string, err error)
- func PathGetValue(value interface{}, path string) (interface{}, error)
- func PathSetValue(attrValue interface{}, path string, value interface{}) error
- func SetPropertyProvider(provider PropertyProvider)
- func SimpleScopeResolve(toResolve string, scope Scope) (value interface{}, err error)
- type Attribute
- type BasicResolver
- type ComplexObject
- type DefaultPropertyProvider
- type Expr
- type FixedScope
- type IOMappings
- type IOMetadata
- type Mapper
- type MapperDef
- type MappingDef
- type MappingType
- type MutableScope
- type PropertyProvider
- type ResolutionDetails
- type Resolver
- type Scope
- type SimpleScope
- type SimpleSyncScope
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CoerceToAny ¶
func CoerceToAny(val interface{}) (interface{}, error)
CoerceToAny coerce a value to generic value
func CoerceToArray ¶
func CoerceToArray(val interface{}) ([]interface{}, error)
CoerceToArray coerce a value to an array of empty interface values
func CoerceToArrayIfNecessary ¶
func CoerceToArrayIfNecessary(val interface{}) (interface{}, error)
CoerceToArrayIfNecessary coerce a value to an array if it isn't one already
func CoerceToBoolean ¶
CoerceToBoolean coerce a value to a boolean
func CoerceToDouble ¶
CoerceToDouble coerce a value to a double/float64
func CoerceToInteger ¶
CoerceToInteger coerce a value to an integer
func CoerceToLong ¶
CoerceToInteger coerce a value to an integer
func CoerceToNumber
deprecated
func CoerceToObject ¶
CoerceToObject coerce a value to an object
func CoerceToParams ¶
CoerceToParams coerce a value to params
func CoerceToString ¶
CoerceToString coerce a value to a string
func CoerceToValue ¶
CoerceToValue coerce a value to the specified type
func GetValueWithResolver ¶
func IsSimpleType ¶
func IsSimpleType(val interface{}) bool
func PathDeconstruct ¶
func PathGetValue ¶
func PathSetValue ¶
func SetPropertyProvider ¶
func SetPropertyProvider(provider PropertyProvider)
func SimpleScopeResolve ¶
Types ¶
type Attribute ¶
type Attribute struct {
// contains filtered or unexported fields
}
Attribute is a simple structure used to define a data Attribute/property
func CloneAttribute ¶
CloneAttribute clones the given attribute assigning a new name
func NewAttribute ¶
NewAttribute constructs a new attribute
func NewZeroAttribute ¶
NewZeroAttribute constructs a new attribute
func (*Attribute) MarshalJSON ¶
MarshalJSON implements json.Marshaler.MarshalJSON
func (*Attribute) UnmarshalJSON ¶
UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON
type BasicResolver ¶
type BasicResolver struct { }
type ComplexObject ¶
type ComplexObject struct { Metadata string `json:"metadata"` Value interface{} `json:"value"` }
ComplexObject is the value that is used when using a "COMPLEX_OBJECT" type
func CoerceToComplexObject ¶
func CoerceToComplexObject(val interface{}) (*ComplexObject, error)
CoerceToObject coerce a value to an complex object
type DefaultPropertyProvider ¶
type DefaultPropertyProvider struct { }
DefaultPropertyProvider empty property provider
func (*DefaultPropertyProvider) GetProperty ¶
func (pp *DefaultPropertyProvider) GetProperty(property string) (value interface{}, exists bool)
type FixedScope ¶
type FixedScope struct {
// contains filtered or unexported fields
}
FixedScope is an implementation of a empty scope fixed to a particular set of metadata
func NewFixedScope ¶
func NewFixedScope(metadata map[string]*Attribute) *FixedScope
NewFixedScope creates a new SimpleScope
func NewFixedScopeFromMap ¶
func NewFixedScopeFromMap(metadata map[string]*Attribute) *FixedScope
func (*FixedScope) GetAttr ¶
func (s *FixedScope) GetAttr(name string) (attr *Attribute, exists bool)
GetAttr implements Scope.GetAttr
func (*FixedScope) GetAttrs ¶
func (s *FixedScope) GetAttrs() map[string]*Attribute
GetAttrs gets the attributes set in the scope
func (*FixedScope) SetAttrValue ¶
func (s *FixedScope) SetAttrValue(name string, value interface{}) error
SetAttrValue implements Scope.SetAttrValue
type IOMappings ¶
type IOMappings struct { Input []*MappingDef `json:"input,omitempty"` Output []*MappingDef `json:"output,omitempty"` }
type IOMetadata ¶
func (*IOMetadata) MarshalJSON ¶
func (md *IOMetadata) MarshalJSON() ([]byte, error)
func (*IOMetadata) UnmarshalJSON ¶
func (md *IOMetadata) UnmarshalJSON(b []byte) error
type MapperDef ¶
type MapperDef struct { //todo possibly add optional lang/mapper type so we can fast fail on unsupported mappings/mapper combo Mappings []*MappingDef }
MapperDef represents a Mapper, which is a collection of mappings
type MappingDef ¶
type MappingDef struct { //Type the mapping type Type MappingType //Value the mapping value to execute to determine the result (rhs) Value interface{} //Result the name of attribute to place the result of the mapping in (lhs) MapTo string }
MappingDef is a simple structure that defines a mapping
func (*MappingDef) UnmarshalJSON ¶
func (md *MappingDef) UnmarshalJSON(b []byte) error
type MappingType ¶
type MappingType int
MappingType is an enum for possible MappingDef Types
const ( // MtAssign denotes an attribute to attribute assignment MtAssign MappingType = 1 // MtLiteral denotes a literal to attribute assignment MtLiteral MappingType = 2 // MtExpression denotes a expression execution to perform mapping MtExpression MappingType = 3 // MtObject denotes a object construction mapping MtObject MappingType = 4 MtArray MappingType = 5 )
func ConvertMappingType ¶
func ConvertMappingType(mapType interface{}) (MappingType, error)
type MutableScope ¶
type MutableScope interface { Scope //AddAttr adds an attribute to the scope AddAttr(name string, valueType Type, value interface{}) *Attribute }
MutableScope is a scope that new attributes can be added
func GetGlobalScope ¶
func GetGlobalScope() MutableScope
GetGlobalScope gets the global scope the application
func NewSimpleSyncScope ¶
func NewSimpleSyncScope(attrs []*Attribute, parentScope Scope) MutableScope
NewSimpleSyncScope creates a new SimpleSyncScope
type PropertyProvider ¶
func GetPropertyProvider ¶
func GetPropertyProvider() PropertyProvider
type ResolutionDetails ¶
func GetResolutionDetails ¶
func GetResolutionDetails(toResolve string) (*ResolutionDetails, error)
func GetResolutionDetailsOld ¶
func GetResolutionDetailsOld(toResolve string) (*ResolutionDetails, error)
type Resolver ¶
func GetBasicResolver ¶
func GetBasicResolver() Resolver
type Scope ¶
type Scope interface { // GetAttr gets the specified attribute GetAttr(name string) (attr *Attribute, exists bool) // SetAttrValue sets the value of the specified attribute SetAttrValue(name string, value interface{}) error }
Scope is a set of attributes that are accessible
func NewSimpleScope ¶
NewSimpleScope creates a new SimpleScope
type SimpleScope ¶
type SimpleScope struct {
// contains filtered or unexported fields
}
SimpleScope is a basic implementation of a scope
func NewSimpleScopeFromMap ¶
func NewSimpleScopeFromMap(attrs map[string]*Attribute, parentScope Scope) *SimpleScope
NewSimpleScopeFromMap creates a new SimpleScope
func (*SimpleScope) AddAttr ¶
func (s *SimpleScope) AddAttr(name string, valueType Type, value interface{}) *Attribute
AddAttr implements MutableScope.AddAttr
func (*SimpleScope) GetAttr ¶
func (s *SimpleScope) GetAttr(name string) (attr *Attribute, exists bool)
GetAttr implements Scope.GetAttr
func (*SimpleScope) SetAttrValue ¶
func (s *SimpleScope) SetAttrValue(name string, value interface{}) error
SetAttrValue implements Scope.SetAttrValue
type SimpleSyncScope ¶
type SimpleSyncScope struct {
// contains filtered or unexported fields
}
SimpleSyncScope is a basic implementation of a synchronized scope
func (*SimpleSyncScope) AddAttr ¶
func (s *SimpleSyncScope) AddAttr(name string, valueType Type, value interface{}) *Attribute
AddAttr implements MutableScope.AddAttr
func (*SimpleSyncScope) GetAttr ¶
func (s *SimpleSyncScope) GetAttr(name string) (value *Attribute, exists bool)
GetAttr implements Scope.GetAttr
func (*SimpleSyncScope) SetAttrValue ¶
func (s *SimpleSyncScope) SetAttrValue(name string, value interface{}) error
SetAttrValue implements Scope.SetAttrValue