data

package
v0.9.0-alpha.6 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2019 License: BSD-3-Clause Imports: 6 Imported by: 132

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSchema

func GetSchema(value TypedValue) (schema.Schema, bool)

func IsSimpleType

func IsSimpleType(val interface{}) bool

func SetAttributeTypeConverter

func SetAttributeTypeConverter(converter TypeConverter)

Types

type Attribute

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

Attribute is a simple structure used to define a data Attribute/property

func NewAttribute

func NewAttribute(name string, dataType Type, value interface{}) *Attribute

TODO this should probably go away

func (*Attribute) Name

func (a *Attribute) Name() string

func (*Attribute) Schema

func (a *Attribute) Schema() schema.Schema

func (*Attribute) Type

func (a *Attribute) Type() Type

func (*Attribute) UnmarshalJSON

func (a *Attribute) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.UnmarshalJSON

func (*Attribute) Value

func (a *Attribute) Value() interface{}

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 DEPRECATED

type Scope

type Scope interface {
	// GetValue gets the specified value
	GetValue(name string) (value interface{}, exists bool)

	// SetValue sets the specified  value
	SetValue(name string, value interface{}) error
}

Scope is a set of attributes that are accessible

func NewSimpleScope

func NewSimpleScope(values map[string]interface{}, parentScope Scope) Scope

NewSimpleScope creates a new SimpleScope

type SimpleScope

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

SimpleScope is a basic implementation of a scope

func (*SimpleScope) GetValue

func (s *SimpleScope) GetValue(name string) (value interface{}, exists bool)

func (*SimpleScope) SetValue

func (s *SimpleScope) SetValue(name string, value interface{}) error

type StringsMap

type StringsMap interface {
	Get(key string) string

	Iterate(itx func(key string, value string))
}

func NewFixedStringsMap

func NewFixedStringsMap(params map[string]string) StringsMap

type StructValue

type StructValue interface {
	ToMap() map[string]interface{}
	FromMap(values map[string]interface{}) error
}

type Type

type Type int

Type denotes a data type

const (
	TypeUnknown Type = iota // interface{}

	TypeAny // interface{}

	// simple types
	TypeString  // string
	TypeInt     // int
	TypeInt32   // int32
	TypeInt64   // int64
	TypeFloat32 // float32
	TypeFloat64 // float64
	TypeBool    // bool
	TypeObject  // map[string]interface{}
	TypeBytes   // []byte

	// compound types
	TypeParams // map[string]string
	TypeArray  // []interface{}
	TypeMap    // map[interface{}]interface{}

	//DEPRECATED
	TypeComplexObject
)

func GetType

func GetType(val interface{}) (Type, error)

GetType get the Type of the supplied value

func ToTypeEnum

func ToTypeEnum(typeStr string) (Type, error)

ToTypeEnum get the data type that corresponds to the specified name

func ToTypeFromGoRep

func ToTypeFromGoRep(strType string) Type

func (Type) IsSimple

func (t Type) IsSimple() bool

func (Type) String

func (t Type) String() string

type TypeConverter

type TypeConverter func(value interface{}, toType Type) (interface{}, error)

type TypedValue

type TypedValue interface {
	Type() Type
	Value() interface{}
}

func NewTypedValue

func NewTypedValue(dataType Type, value interface{}) TypedValue

func NewTypedValueFromAttr

func NewTypedValueFromAttr(attr *Attribute) TypedValue

func NewTypedValueWithConversion

func NewTypedValueWithConversion(dataType Type, value interface{}) (TypedValue, error)

func ToTypedValue

func ToTypedValue(value interface{}) TypedValue

Jump to

Keyboard shortcuts

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