data

package
v1.6.3 Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: BSD-3-Clause Imports: 8 Imported by: 118

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

func NewAttributeWithSchema

func NewAttributeWithSchema(name string, dataType Type, value interface{}, schema schema.Schema) *Attribute

func (*Attribute) MarshalJSON

func (a *Attribute) MarshalJSON() ([]byte, error)

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 NeedsDelete added in v1.3.0

type NeedsDelete interface {
	// Delete data from scope
	Delete(name string)
}

NeedDelete uses to delete attributes from Scope

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

func NewSimpleSyncScope

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

NewSimpleSyncScope creates a new SimpleSyncScope

type SimpleScope

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

SimpleScope is a basic implementation of a scope

func (*SimpleScope) Delete added in v1.3.0

func (s *SimpleScope) Delete(name string)

Delete implements ScopeDel.Delete

func (*SimpleScope) GetValue

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

GetValue implements Scope.GetValue

func (*SimpleScope) SetValue

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

SetValue implements Scope.SetValue

type SimpleSyncScope

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

SimpleSyncScope is a basic implementation of a synchronized scope

func (*SimpleSyncScope) Delete added in v1.3.0

func (s *SimpleSyncScope) Delete(name string)

Delete implements Scope.GetValue

func (*SimpleSyncScope) GetValue

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

GetValue implements Scope.GetValue

func (*SimpleSyncScope) SetValue

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

SetValue implements Scope.SetValue

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
	TypeDateTime // time

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

	//Special Type
	TypeConnection
)

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

IsSimple returns wither a type is simple

func (Type) Name added in v0.9.2

func (t Type) Name() string

Name returns the name of the type

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