data

package
Version: v1.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 10 Imported by: 72

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnyValue

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

Cross-language implementation of dynamic object what can hold value of any type. The stored value can be converted to different types using variety of accessor methods.

Example:

value := data.NewAnyValue("123.456")

value.GetAsInteger() // Result: 123
value.GetAsString()  // Result: "123.456"
value.GetAsFloat()   // Result: 123.456

func NewAnyValue

func NewAnyValue(value interface{}) *AnyValue

Creates a new instance of the object and assigns its value. Parameters: "value" - value to initialize this object. Returns: new object.

func NewEmptyAnyValue

func NewEmptyAnyValue() *AnyValue

Creates a new empty instance of the object Returns: new empty object

func (*AnyValue) Clone

func (c *AnyValue) Clone() interface{}

Creates a binary clone of this object. Returns: a clone of this object.

func (*AnyValue) Equals

func (c *AnyValue) Equals(obj interface{}) bool

Compares this object value to specified specified value. When direct comparison gives negative results it tries to compare values as strings. Parameters: "obj" - the value to be compared with. Returns: true when objects are equal and false otherwise.

func (*AnyValue) EqualsAsType

func (c *AnyValue) EqualsAsType(typ convert.TypeCode, obj interface{}) bool

Compares this object value to specified specified value. When direct comparison gives negative results it converts values to type specified by type code and compare them again. Parameters:

"typ" - the TypeCode that defined the type of the result.
"obj" - the value to be compared with.

Returns: true when objects are equal and false otherwise.

func (*AnyValue) GetAsArray

func (c *AnyValue) GetAsArray() *AnyValueArray

Converts object value into an AnyArray or returns empty AnyArray if conversion is not possible. Returns: AnyArray value or empty AnyArray if conversion is not supported.

func (*AnyValue) GetAsBoolean

func (c *AnyValue) GetAsBoolean() bool

Converts object value into a boolean or returns false if conversion is not possible. Returns: string value or false if conversion is not supported.

func (*AnyValue) GetAsBooleanWithDefault

func (c *AnyValue) GetAsBooleanWithDefault(defaultValue bool) bool

Converts object value into a boolean or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value. Returns: boolean value or default if conversion is not supported.

func (*AnyValue) GetAsDateTime

func (c *AnyValue) GetAsDateTime() time.Time

Converts object value into a Date or returns current date if conversion is not possible. Returns: DateTime value or current date if conversion is not supported.

func (*AnyValue) GetAsDateTimeWithDefault

func (c *AnyValue) GetAsDateTimeWithDefault(defaultValue time.Time) time.Time

Converts object value into a Date or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: DateTime value or default if conversion is not supported.

func (*AnyValue) GetAsDouble

func (c *AnyValue) GetAsDouble() float64

Converts object value into a double or returns 0 if conversion is not possible. Returns: double value or 0 if conversion is not supported.

func (*AnyValue) GetAsDoubleWithDefault

func (c *AnyValue) GetAsDoubleWithDefault(defaultValue float64) float64

Converts object value into a double or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: double value or default if conversion is not supported.

func (*AnyValue) GetAsDuration

func (c *AnyValue) GetAsDuration() time.Duration

Converts object value into a Duration or returns current date if conversion is not possible. Returns: Duration value or current date if conversion is not supported.

func (*AnyValue) GetAsDurationWithDefault

func (c *AnyValue) GetAsDurationWithDefault(defaultValue time.Duration) time.Duration

Converts object value into a Duration or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: Duration value or default if conversion is not supported.

func (*AnyValue) GetAsFloat

func (c *AnyValue) GetAsFloat() float32

Converts object value into a float or returns 0 if conversion is not possible. Returns: float value or 0 if conversion is not supported.

func (*AnyValue) GetAsFloatWithDefault

func (c *AnyValue) GetAsFloatWithDefault(defaultValue float32) float32

Converts object value into a float or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: float value or default if conversion is not supported.

func (*AnyValue) GetAsInteger

func (c *AnyValue) GetAsInteger() int

Converts object value into an integer or returns 0 if conversion is not possible. Returns: integer value or 0 if conversion is not supported.

func (*AnyValue) GetAsIntegerWithDefault

func (c *AnyValue) GetAsIntegerWithDefault(defaultValue int) int

Converts object value into a integer or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: integer value or default if conversion is not supported.

func (*AnyValue) GetAsLong

func (c *AnyValue) GetAsLong() int64

Converts object value into a long or returns 0 if conversion is not possible. Returns: string value or 0 if conversion is not supported.

func (*AnyValue) GetAsLongWithDefault

func (c *AnyValue) GetAsLongWithDefault(defaultValue int64) int64

Converts object value into a long or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: long value or default if conversion is not supported.

func (*AnyValue) GetAsMap

func (c *AnyValue) GetAsMap() *AnyValueMap

Converts object value into AnyMap or returns empty AnyMap if conversion is not possible. Returns: AnyMap value or empty AnyMap if conversion is not supported.

func (*AnyValue) GetAsNullableBoolean

func (c *AnyValue) GetAsNullableBoolean() *bool

Converts object value into a boolean or returns null if conversion is not possible. Returns: boolean value or null if conversion is not supported.

func (*AnyValue) GetAsNullableDateTime

func (c *AnyValue) GetAsNullableDateTime() *time.Time

Converts object value into a Date or returns null if conversion is not possible. Returns: DateTime value or null if conversion is not supported.

func (*AnyValue) GetAsNullableDouble

func (c *AnyValue) GetAsNullableDouble() *float64

Converts object value into a double or returns null if conversion is not possible. Returns: double value or null if conversion is not supported.

func (*AnyValue) GetAsNullableDuration

func (c *AnyValue) GetAsNullableDuration() *time.Duration

Converts object value into a Duration or returns null if conversion is not possible. Returns: Duration value or null if conversion is not supported.

func (*AnyValue) GetAsNullableFloat

func (c *AnyValue) GetAsNullableFloat() *float32

Converts object value into a float or returns null if conversion is not possible. Returns: float value or null if conversion is not supported.

func (*AnyValue) GetAsNullableInteger

func (c *AnyValue) GetAsNullableInteger() *int

Converts object value into an integer or returns null if conversion is not possible. Returns: integer value or null if conversion is not supported.

func (*AnyValue) GetAsNullableLong

func (c *AnyValue) GetAsNullableLong() *int64

Converts object value into a long or returns null if conversion is not possible. Returns: long value or null if conversion is not supported.

func (*AnyValue) GetAsNullableString

func (c *AnyValue) GetAsNullableString() *string

Converts object value into a string or returns null if conversion is not possible. Returns: string value or null if conversion is not supported.

func (*AnyValue) GetAsNullableType

func (c *AnyValue) GetAsNullableType(typ convert.TypeCode) interface{}

Converts object value into a value defined by specied typecode. If conversion is not possible it returns null. Parameters: "typ" - the TypeCode that defined the type of the result. Returns: value defined by the typecode or null if conversion is not supported.

func (*AnyValue) GetAsObject

func (c *AnyValue) GetAsObject() interface{}

Gets the value stored in this object without any conversions. Returns: the object value.

func (*AnyValue) GetAsString

func (c *AnyValue) GetAsString() string

Converts object value into a string or returns "" if conversion is not possible. Returns: string value or "" if conversion is not supported.

func (*AnyValue) GetAsStringWithDefault

func (c *AnyValue) GetAsStringWithDefault(defaultValue string) string

Converts object value into a string or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value. Returns: string value or default if conversion is not supported.

func (*AnyValue) GetAsType

func (c *AnyValue) GetAsType(typ convert.TypeCode) interface{}

Converts object value into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. Parameters: "typ" - the TypeCode that defined the type of the result. Returns: value defined by the typecode or type default value if conversion is not supported.

func (*AnyValue) GetAsTypeWithDefault

func (c *AnyValue) GetAsTypeWithDefault(typ convert.TypeCode, defaultValue interface{}) interface{}

Converts object value into a value defined by specied typecode. If conversion is not possible it returns default value. Parameters:

"typ" - the TypeCode that defined the type of the result;
"defaultValue" - the default value.

Returns: value defined by the typecode or type default value if conversion is not supported.

func (*AnyValue) GetAsUInteger added in v1.1.1

func (c *AnyValue) GetAsUInteger() uint

Converts object value into an unsigned integer or returns 0 if conversion is not possible. Returns: unsigned integer value or 0 if conversion is not supported.

func (*AnyValue) GetAsUIntegerWithDefault added in v1.1.1

func (c *AnyValue) GetAsUIntegerWithDefault(defaultValue uint) uint

Converts object value into a unsigned integer or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: unsigned integer value or default if conversion is not supported.

func (*AnyValue) GetAsULong added in v1.1.1

func (c *AnyValue) GetAsULong() uint64

Converts object value into a unsiged long or returns 0 if conversion is not possible. Returns: unsiged long value or 0 if conversion is not supported.

func (*AnyValue) GetAsULongWithDefault added in v1.1.1

func (c *AnyValue) GetAsULongWithDefault(defaultValue uint64) uint64

Converts object value into a unsiged long or returns default value if conversion is not possible. Parameters: "defaultValue" - the default value Returns: unsiged long value or default if conversion is not supported.

func (*AnyValue) InnerValue

func (c *AnyValue) InnerValue() interface{}

Gets the value stored in this object without any conversions. Returns: the object value.

func (*AnyValue) SetAsObject

func (c *AnyValue) SetAsObject(value interface{})

Sets a new value for this object. Parameters: "value" - the new object value.

func (*AnyValue) String

func (c *AnyValue) String() string

Gets a string representation of the object. Returns: a string representation of the object.

func (*AnyValue) TypeCode

func (c *AnyValue) TypeCode() convert.TypeCode

Gets type code for the value stored in this object. Returns: type code of the object value.

func (*AnyValue) Value

func (c *AnyValue) Value() interface{}

Gets the value stored in this object without any conversions. Returns: the object value.

type AnyValueArray

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

Cross-language implementation of dynamic object array what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.

Example:

value1 :=  NewAnyValueArray([1, "123.456", "2018-01-01"]);

value1.GetAsBoolean(0);   // Result: true
value1.GetAsInteger(1);   // Result: 123
value1.GetAsFloat(1);     // Result: 123.456
value1.GetAsDateTime(2);  // Result: new Date(2018,0,1)

see StringConverter see TypeConverter see BooleanConverter see IntegerConverter see LongConverter see DoubleConverter see FloatConverter see DateTimeConverter see ICloneable

func NewAnyValueArray

func NewAnyValueArray(values []interface{}) *AnyValueArray

Creates a new instance of the array and assigns its value. Parameters:

  • values []interface{}

Returns *AnyValueArray

func NewAnyValueArrayFromString

func NewAnyValueArrayFromString(values string, separator string, removeDuplicates bool) *AnyValueArray

Splits specified string into elements using a separator and assigns the elements to a newly created AnyValueArray. Parameters:

  • values string a string value to be split and assigned to AnyValueArray separator string a separator to split the string
  • removeDuplicates bool true to remove duplicated elements

Returns *AnyValueArray a newly created AnyValueArray.

func NewAnyValueArrayFromValue

func NewAnyValueArrayFromValue(value interface{}) *AnyValueArray

Converts specified value into AnyValueArray. see ArrayConverter.toNullableArray Parameters:

  • value interface{} value to be converted

Returns *AnyValueArray a newly created AnyValueArray.

func NewAnyValueArrayFromValues

func NewAnyValueArrayFromValues(values ...interface{}) *AnyValueArray

Creates a new AnyValueArray from a list of values Parameters:

  • values ...values interface{} a list of values to initialize the created AnyValueArray

Returns *AnyValueArray a newly created AnyValueArray.

func NewEmptyAnyValueArray

func NewEmptyAnyValueArray() *AnyValueArray

Creates a new instance of the empty array. Returns *AnyValueArray

func (*AnyValueArray) Append

func (c *AnyValueArray) Append(elements []interface{})

Appends new elements to this array. Parameters:

  • elements []interface{} a list of elements to be added.

func (*AnyValueArray) Clear

func (c *AnyValueArray) Clear()

Clears this array by removing all its elements.

func (*AnyValueArray) Clone

func (c *AnyValueArray) Clone() interface{}

Creates a binary clone of this object. Returns interface{} a clone of this object.

func (*AnyValueArray) Contains

func (c *AnyValueArray) Contains(value interface{}) bool

Checks if this array contains a value. The check uses direct comparison between elements and the specified value. Parameters:

  • value interface{} a value to be checked

Returns bool true if this array contains the value or false otherwise.

func (*AnyValueArray) ContainsAsType

func (c *AnyValueArray) ContainsAsType(typ convert.TypeCode, value interface{}) bool

Parameters:

  • typeCode TypeCode a type code that defines a type to convert values before comparison
  • value interface{} a value to be checked

Returns bool true if this array contains the value or false otherwise.

func (*AnyValueArray) Get

func (c *AnyValueArray) Get(index int) interface{}

Gets an array element specified by its index. Parameters:

  • index int an index of the element to get.

Returns interface {} the value of the array element.

func (*AnyValueArray) GetAsArray

func (c *AnyValueArray) GetAsArray(index int) *AnyValueArray

Converts array element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. see fromValue Parameters:

  • index int an index of element to get.

Returns *AnyValueArray AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.

func (*AnyValueArray) GetAsArrayWithDefault

func (c *AnyValueArray) GetAsArrayWithDefault(index int, defaultValue *AnyValueArray) *AnyValueArray

Converts array element into an AnyValueArray or returns default value if conversion is not possible. see getAsNullableArray Parameters:

  • index int an index of element to get.
  • defaultValue *AnyValueArray the default value

Returns *AnyValueArray AnyValueArray value of the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsBoolean

func (c *AnyValueArray) GetAsBoolean(index int) bool

Converts array element into a boolean or returns false if conversion is not possible. see getAsBooleanWithDefault Parameters:

  • index int an index of element to get.

Returns bool boolean value ot the element or false if conversion is not supported.

func (*AnyValueArray) GetAsBooleanWithDefault

func (c *AnyValueArray) GetAsBooleanWithDefault(index int, defaultValue bool) bool

Converts array element into a boolean or returns default value if conversion is not possible. see BooleanConverter.toBooleanWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue: boolean the default value

Returns bool boolean value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsDateTime

func (c *AnyValueArray) GetAsDateTime(index int) time.Time

Converts array element into a time.Time or returns the current date if conversion is not possible. see getAsDateTimeWithDefault Parameters:

  • index int an index of element to get.

Returns time.Time time.Time value ot the element or the current date if conversion is not supported.

func (*AnyValueArray) GetAsDateTimeWithDefault

func (c *AnyValueArray) GetAsDateTimeWithDefault(index int, defaultValue time.Time) time.Time

Converts array element into a time.Time or returns default value if conversion is not possible. see DateTimeConverter.toDateTimeWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue: time.Time the default value

Returns time.Time time.time value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsDouble

func (c *AnyValueArray) GetAsDouble(index int) float64

Converts array element into a double or returns 0 if conversion is not possible. see getAsDoubleWithDefault Parameters:

  • index int an index of element to get.

Returns float64 double value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsDoubleWithDefault

func (c *AnyValueArray) GetAsDoubleWithDefault(index int, defaultValue float64) float64

Converts array element into a double or returns default value if conversion is not possible. see DoubleConverter.toDoubleWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue: float64 the default value

Returns float64 double value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsDuration

func (c *AnyValueArray) GetAsDuration(index int) time.Duration

Converts array element into a time.Duration or returns the current date if conversion is not possible. see getAsDateTimeWithDefault Parameters:

  • index int an index of element to get.

Returns time.Duration Date value ot the element or the current date if conversion is not supported.

func (*AnyValueArray) GetAsDurationWithDefault

func (c *AnyValueArray) GetAsDurationWithDefault(index int, defaultValue time.Duration) time.Duration

Converts array element into a time.Duration or returns default value if conversion is not possible. see DateTimeConverter.toDateTimeWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue: ttime.Duration the default value

Returns time.Duration Date value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsFloat

func (c *AnyValueArray) GetAsFloat(index int) float32

Converts array element into a float or returns 0 if conversion is not possible. see getAsFloatWithDefault Parameters:

  • index int an index of element to get.

Returns float32 float value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsFloatWithDefault

func (c *AnyValueArray) GetAsFloatWithDefault(index int, defaultValue float32) float32

Converts array element into a float or returns default value if conversion is not possible. see FloatConverter.toFloatWithDefault Parameters:

  • index int an index of element to get.

defaultValue: number the default value Returns number float value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsInteger

func (c *AnyValueArray) GetAsInteger(index int) int

Converts array element into an integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • index int an index of element to get.

Returns int integer value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsIntegerWithDefault

func (c *AnyValueArray) GetAsIntegerWithDefault(index int, defaultValue int) int

Converts array element into an integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue int the default value

Returns int integer value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsLong

func (c *AnyValueArray) GetAsLong(index int) int64

Converts array element into a long or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • index int an index of element to get.

Returns int64 int64 value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsLongWithDefault

func (c *AnyValueArray) GetAsLongWithDefault(index int, defaultValue int64) int64

func (*AnyValueArray) GetAsMap

func (c *AnyValueArray) GetAsMap(index int) *AnyValueMap

Returns *AnyValueMap

func (*AnyValueArray) GetAsMapWithDefault

func (c *AnyValueArray) GetAsMapWithDefault(index int, defaultValue *AnyValueMap) *AnyValueMap

Converts array element into an AnyValueMap or returns default value if conversion is not possible. see getAsNullableMap Parameters

  • index int an index of element to get.
  • defaultValue *AnyValueMap the default value

Returns *AnyValueMap AnyValueMap value of the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsNullableArray

func (c *AnyValueArray) GetAsNullableArray(index int) *AnyValueArray

Converts array element into an AnyValueArray or returns nil if conversion is not possible. see fromValue Parameters:

  • index int an index of element to get.

Returns *AnyValueArray AnyValueArray value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableBoolean

func (c *AnyValueArray) GetAsNullableBoolean(index int) *bool

Converts array element into a boolean or returns nil if conversion is not possible. see BooleanConverter.toNullableBoolean Parameters:

  • index int an index of element to get.

Returns bool boolean value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableDateTime

func (c *AnyValueArray) GetAsNullableDateTime(index int) *time.Time

Converts array element into a time.Time or returns nil if conversion is not possible. see DateTimeConverter.toNullableDateTime Parameters:

  • index int an index of element to get.

Returns *time.Time time.Time value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableDouble

func (c *AnyValueArray) GetAsNullableDouble(index int) *float64

Converts array element into a double or returns nil if conversion is not possible. see DoubleConverter.toNullableDouble Parameters:

  • index int an index of element to get.

Returns *float64 float64 value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableDuration

func (c *AnyValueArray) GetAsNullableDuration(index int) *time.Duration

Converts array element into a time.Duration or returns nil if conversion is not possible. see DateTimeConverter.toNullableDateTime Parameters:

  • index int an index of element to get.

Returns *time.Duration time.Duration value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableFloat

func (c *AnyValueArray) GetAsNullableFloat(index int) *float32

Converts array element into a float or returns nil if conversion is not possible. see FloatConverter.toNullableFloat Parameters:

  • index int an index of element to get.

Returns *float64 float64 value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableInteger

func (c *AnyValueArray) GetAsNullableInteger(index int) *int

Converts array element into an integer or returns nil if conversion is not possible. see IntegerConverter.toNullableInteger Parameters:

  • index int an index of element to get.

Returns *int integer value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableLong

func (c *AnyValueArray) GetAsNullableLong(index int) *int64

Converts array element into a long or returns nil if conversion is not possible. see LongConverter.toNullableLong Parameters:

  • index int an index of element to get.

Returns *int64 int64 value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableMap

func (c *AnyValueArray) GetAsNullableMap(index int) *AnyValueMap

Converts array element into an AnyValueMap or returns nil if conversion is not possible. see AnyValueMap see AnyValueMap.fromValue Parameters:

  • index int an index of element to get.

Returns *AnyValueMap AnyValueMap value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableString

func (c *AnyValueArray) GetAsNullableString(index int) *string

Converts array element into a string or returns nil if conversion is not possible. see StringConverter.toNullableString Parameters:

  • index int an index of element to get.

Returns *string string value of the element or nil if conversion is not supported.

func (*AnyValueArray) GetAsNullableType

func (c *AnyValueArray) GetAsNullableType(typ convert.TypeCode, index int) interface{}

Converts array element into a value defined by specied typecode. If conversion is not possible it returns nil. see TypeConverter.toNullableType Parameters

  • type: TypeCode the TypeCode that defined the type of the result
  • index int an index of element to get.

Returns interface{} element value defined by the typecode or nil if conversion is not supported.

func (*AnyValueArray) GetAsObject

func (c *AnyValueArray) GetAsObject(index int) interface{}

Gets the value stored in array element without any conversions. When element index is not defined it returns the entire array value. Parameters

  • indexint an index of the element to get

Returns interface{} the element value or value of the array when index is not defined.

func (*AnyValueArray) GetAsSingleObject

func (c *AnyValueArray) GetAsSingleObject() interface{}

Inflate AnyValueArray as single object Return interface{}

func (*AnyValueArray) GetAsString

func (c *AnyValueArray) GetAsString(index int) string

Converts array element into a string or returns "" if conversion is not possible. see getAsStringWithDefault Parameters:

  • index int an index of element to get.

Returns string string value ot the element or "" if conversion is not supported.

func (*AnyValueArray) GetAsStringWithDefault

func (c *AnyValueArray) GetAsStringWithDefault(index int, defaultValue string) string

Converts array element into a string or returns default value if conversion is not possible. see StringConverter.toStringWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue: string the default value

Returns string string value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsType

func (c *AnyValueArray) GetAsType(typ convert.TypeCode, index int) interface{}

Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. see getAsTypeWithDefault Parameters:

  • type TypeCode the TypeCode that defined the type of the result
  • index int an index of element to get.

Returns interface{} element value defined by the typecode or default if conversion is not supported.

func (*AnyValueArray) GetAsTypeWithDefault

func (c *AnyValueArray) GetAsTypeWithDefault(typ convert.TypeCode, index int, defaultValue interface{}) interface{}

Converts array element into a value defined by specied typecode. If conversion is not possible it returns default value. see TypeConverter.toTypeWithDefault Parameters:

  • type TypeCode the TypeCode that defined the type of the result
  • index int an index of element to get.
  • defaultValue interface{} the default value

Returns interface{} element value defined by the typecode or default value if conversion is not supported.

func (*AnyValueArray) GetAsUInteger added in v1.1.1

func (c *AnyValueArray) GetAsUInteger(index int) uint

Converts array element into an unsigned integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • index int an index of element to get.

Returns uint unsigned integer value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsUIntegerWithDefault added in v1.1.1

func (c *AnyValueArray) GetAsUIntegerWithDefault(index int, defaultValue uint) uint

Converts array element into an integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue uint the default value

Returns uint unsigned integer value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsULong added in v1.1.1

func (c *AnyValueArray) GetAsULong(index int) uint64

Converts array element into a unsigned long or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • index int an index of element to get.

Returns uint64 uint64 value ot the element or 0 if conversion is not supported.

func (*AnyValueArray) GetAsULongWithDefault added in v1.1.1

func (c *AnyValueArray) GetAsULongWithDefault(index int, defaultValue uint64) uint64

Converts array element into a unsigned long or returns default value if conversion is not possible. see LongConverter.toLongWithDefault Parameters:

  • index int an index of element to get.
  • defaultValue int64 the default value

Returns uint64 uint64 value ot the element or default value if conversion is not supported.

func (*AnyValueArray) GetAsValue

func (c *AnyValueArray) GetAsValue(index int) *AnyValue

Converts array element into an AnyValue or returns an empty AnyValue if conversion is not possible. see AnyValue see AnyValue.constructor Parameters:

  • index int an index of element to get.

Returns *AnyValue AnyValue value of the element or empty AnyValue if conversion is not supported.

func (*AnyValueArray) InnerValue

func (c *AnyValueArray) InnerValue() interface{}

Return inner value of array as interface{}

func (*AnyValueArray) Len

func (c *AnyValueArray) Len() int

Returns length of array

func (*AnyValueArray) Push

func (c *AnyValueArray) Push(value interface{})

Push element in the end of array Parameters:

  • value interface{} an value what need to insert

func (*AnyValueArray) Put

func (c *AnyValueArray) Put(index int, value interface{})

func (*AnyValueArray) Remove

func (c *AnyValueArray) Remove(index int)

Removes an array element specified by its index Parameters:

  • index int an index of the element to remove.

func (*AnyValueArray) SetAsObject

func (c *AnyValueArray) SetAsObject(index int, value interface{})

Sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value. see ArrayConverter.toArray Parameters:

  • index int an index of the element to set
  • value interface{}

a new element or array value.

func (*AnyValueArray) SetAsSingleObject

func (c *AnyValueArray) SetAsSingleObject(value interface{})

Set AnyValueArray from input object Parameters:

  • value interface{} input object

func (*AnyValueArray) String

func (c *AnyValueArray) String() string

func (*AnyValueArray) Value

func (c *AnyValueArray) Value() []interface{}

Returns array of elements []interface{}

type AnyValueMap

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

Cross-language implementation of dynamic object map (dictionary) what can hold values of any type. The stored values can be converted to different types using variety of accessor methods.

Example

value1 := AnyValueMap({ key1: 1, key2: "123.456", key3: "2018-01-01" });

value1.GetAsBoolean("key1");   // Result: true
value1.GetAsInteger("key2");   // Result: 123
value1.getAsFloat("key2");     // Result: 123.456
value1.GetAsDateTime("key3");  // Result: new Date(2018,0,1)

see StringConverter see TypeConverter see BooleanConverter see IntegerConverter see LongConverter see DoubleConverter see FloatConverter see DateTimeConverter see ICloneable

func InheritAnyValueMap

func InheritAnyValueMap(base IMap) *AnyValueMap

Creates a new instance of the map and assigns base methods from interface. Parameters:

  • base IMap

Returns *AnyValueMap

func NewAnyValueMap

func NewAnyValueMap(value map[string]interface{}) *AnyValueMap

Creates a new instance of the map and assigns its value. Parameters:

  • values map[string]interface{}

Returns *AnyValueMap

func NewAnyValueMapFromMaps

func NewAnyValueMapFromMaps(maps ...map[string]interface{}) *AnyValueMap

Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. Parameters:

maps ...maps: any[]
an array of maps to be merged

Returns *AnyValueMap a newly created AnyValueMap.

func NewAnyValueMapFromTuples

func NewAnyValueMapFromTuples(tuples ...interface{}) *AnyValueMap

Creates a new AnyValueMap from a list of key-value pairs called tuples. see fromTuplesArray Parameters:

  • tuples ...tuples: interface{} a list of values where odd elements are keys and the following even elements are values

Returns *AnyValueMap a newly created AnyValueArray.

func NewAnyValueMapFromTuplesArray

func NewAnyValueMapFromTuplesArray(tuples []interface{}) *AnyValueMap

func NewAnyValueMapFromValue

func NewAnyValueMapFromValue(value interface{}) *AnyValueMap

Converts specified value into AnyValueMap. see setAsObject Parameters:

  • value interface {} value to be converted

Returns *AnyValueMap a newly created AnyValueMap.

func NewEmptyAnyValueMap

func NewEmptyAnyValueMap() *AnyValueMap

Creates a new empty instance of the map. Returns *AnyValueMap

func (*AnyValueMap) Append

func (c *AnyValueMap) Append(value map[string]interface{})

Appends new elements to this map. Parameters:

value: map[string]interface{}

a map of elements to be added.

func (*AnyValueMap) Clear

func (c *AnyValueMap) Clear()

Clears this map by removing all its elements.

func (*AnyValueMap) Clone

func (c *AnyValueMap) Clone() interface{}

Creates a binary clone of this object. Returns any a clone of this object.

func (*AnyValueMap) Contains

func (c *AnyValueMap) Contains(key string) bool

Checks if this map contains a key. The check uses direct comparison between key and the specified key value. Parameters

  • key string a value to be checked

Returns bool true if this map contains the key or false otherwise.

func (*AnyValueMap) Get

func (c *AnyValueMap) Get(key string) interface{}

Gets a map element specified by its key. Parameters:

  • key string a key of the element to get.

Returns interface {} the value of the map element.

func (*AnyValueMap) GetAsArray

func (c *AnyValueMap) GetAsArray(key string) *AnyValueArray

Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. see AnyValueArray see AnyValueArray.fromValue Parameters:

key string
a key of element to get.

Returns *AnyValueArray AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.

func (*AnyValueMap) GetAsArrayWithDefault

func (c *AnyValueMap) GetAsArrayWithDefault(key string, defaultValue *AnyValueArray) *AnyValueArray

Converts map element into an AnyValueArray or returns default value if conversion is not possible. see AnyValueArray see getAsNullableArray Parameters:

  • key string a key of element to get.
  • defaultValue: *AnyValueArray the default value

Returns *AnyValueArray AnyValueArray value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsBoolean

func (c *AnyValueMap) GetAsBoolean(key string) bool

Converts map element into a boolean or returns false if conversion is not possible. see getAsBooleanWithDefault Parameters:

  • key: string a key of element to get.

Returns bool bool value of the element or false if conversion is not supported.

func (*AnyValueMap) GetAsBooleanWithDefault

func (c *AnyValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool

Converts map element into a boolean or returns default value if conversion is not possible. see BooleanConverter.toBooleanWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue bool the default value

Returns bool bool value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsDateTime

func (c *AnyValueMap) GetAsDateTime(key string) time.Time

Converts map element into a time.Time or returns the current date if conversion is not possible. see getAsDateTimeWithDefault Parameters:

  • key string a key of element to get.

Returns time.Time time.Time value of the element or the current date if conversion is not supported.

func (*AnyValueMap) GetAsDateTimeWithDefault

func (c *AnyValueMap) GetAsDateTimeWithDefault(key string, defaultValue time.Time) time.Time

Converts map element into a time.Time or returns default value if conversion is not possible. see DateTimeConverter.toDateTimeWithDefault Parameters:

  • key: string a key of element to get.
  • defaultValue: Date the default value

Returns time.Time time.Time value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsDouble

func (c *AnyValueMap) GetAsDouble(key string) float64

Converts map element into a double or returns 0 if conversion is not possible. see getAsDoubleWithDefault Parameters:

  • key string a key of element to get.

Returns float64 float64 value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsDoubleWithDefault

func (c *AnyValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64

Converts map element into a double or returns default value if conversion is not possible. see DoubleConverter.toDoubleWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue float64 the default value

Returns float64 float64 value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsDuration

func (c *AnyValueMap) GetAsDuration(key string) time.Duration

Converts map element into a time.Duration or returns the current date if conversion is not possible. see getAsDateTimeWithDefault Parameters:

  • key string a key of element to get.

Returns time.Duration time.Duration value of the element or the current date if conversion is not supported.

func (*AnyValueMap) GetAsDurationWithDefault

func (c *AnyValueMap) GetAsDurationWithDefault(key string, defaultValue time.Duration) time.Duration

Converts map element into a time.Duration or returns default value if conversion is not possible. see DateTimeConverter.toDateTimeWithDefault Parameters:

  • key: string a key of element to get.
  • defaultValue: Date the default value

Returns time.Duration time.Duration value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsFloat

func (c *AnyValueMap) GetAsFloat(key string) float32

Converts map element into a float or returns 0 if conversion is not possible. see getAsFloatWithDefault Parameters:

  • key string a key of element to get.

Returns float32 float32 value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsFloatWithDefault

func (c *AnyValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32

Converts map element into a flot or returns default value if conversion is not possible. see FloatConverter.toFloatWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue float32 the default value

Returns float32 float32 value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsInteger

func (c *AnyValueMap) GetAsInteger(key string) int

Converts map element into an integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • key string a key of element to get.

Returns int integer value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsIntegerWithDefault

func (c *AnyValueMap) GetAsIntegerWithDefault(key string, defaultValue int) int

Converts map element into an integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • key string a key of element to get. -defaultValue int the default value

Returns int integer value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsLong

func (c *AnyValueMap) GetAsLong(key string) int64

Converts map element into a long or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • key string a key of element to get.

Returns int64 int64 value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsLongWithDefault

func (c *AnyValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64

Converts map element into a long or returns default value if conversion is not possible. see LongConverter.toLongWithDefault Parameters:

-key string
a key of element to get.
- defaultValue int64
the default value

Returns int64 int64 value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsMap

func (c *AnyValueMap) GetAsMap(key string) *AnyValueMap

Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. see fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueMap AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.

func (*AnyValueMap) GetAsMapWithDefault

func (c *AnyValueMap) GetAsMapWithDefault(key string, defaultValue *AnyValueMap) *AnyValueMap

Converts map element into an AnyValueMap or returns default value if conversion is not possible. see getAsNullableMap Parameters:

  • key string a key of element to get.
  • defaultValue *AnyValueMap the default value

Returns *AnyValueMap AnyValueMap value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsNullableArray

func (c *AnyValueMap) GetAsNullableArray(key string) *AnyValueArray

Converts map element into an AnyValueArray or returns null if conversion is not possible. see AnyValueArray see AnyValueArray.fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueArray AnyValueArray value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableBoolean

func (c *AnyValueMap) GetAsNullableBoolean(key string) *bool

Converts map element into a boolean or returns null if conversion is not possible. see BooleanConverter.toNullableBoolean Parameters:

  • key string a key of element to get.

Returns bool bool value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableDateTime

func (c *AnyValueMap) GetAsNullableDateTime(key string) *time.Time

func (*AnyValueMap) GetAsNullableDouble

func (c *AnyValueMap) GetAsNullableDouble(key string) *float64

func (*AnyValueMap) GetAsNullableDuration

func (c *AnyValueMap) GetAsNullableDuration(key string) *time.Duration

Converts map element into a time.Duration or returns null if conversion is not possible. see DateTimeConverter.toNullableDateTime Parameters:

  • key string a key of element to get.

Returns *time.Duration time.Duration value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableFloat

func (c *AnyValueMap) GetAsNullableFloat(key string) *float32

func (*AnyValueMap) GetAsNullableInteger

func (c *AnyValueMap) GetAsNullableInteger(key string) *int

Converts map element into an integer or returns null if conversion is not possible. see IntegerConverter.toNullableInteger Parameters:

  • key string a key of element to get.

Returns *int integer value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableLong

func (c *AnyValueMap) GetAsNullableLong(key string) *int64

Converts map element into a long or returns null if conversion is not possible. see LongConverter.toNullableLong Parameters:

  • key string a key of element to get.

Returns *int64 int64 value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableMap

func (c *AnyValueMap) GetAsNullableMap(key string) *AnyValueMap

Converts map element into an AnyValueMap or returns null if conversion is not possible. see fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueMap *AnyValueMap value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableString

func (c *AnyValueMap) GetAsNullableString(key string) *string

Converts map element into a string or returns null if conversion is not possible. see StringConverter.toNullableString Parameters:

  • key string a key of element to get.

Returns string string value of the element or null if conversion is not supported.

func (*AnyValueMap) GetAsNullableType

func (c *AnyValueMap) GetAsNullableType(typ convert.TypeCode, key string) interface{}

Converts map element into a value defined by specied typecode. If conversion is not possible it returns null. see TypeConverter.toNullableType Parameters:

  • type TypeCode the TypeCode that defined the type of the result
  • key string a key of element to get.

Returns interface{} element value defined by the typecode or null if conversion is not supported.

func (*AnyValueMap) GetAsObject

func (c *AnyValueMap) GetAsObject(key string) interface{}

Gets the value stored in map element without any conversions. When element key is not defined it returns the entire map value. Parameters:

  • key string a key of the element to get

Returns interface{} the element value or value of the map when index is not defined.

func (*AnyValueMap) GetAsSingleObject

func (c *AnyValueMap) GetAsSingleObject() interface{}

Gets the value stored in map element without any conversions. When element index is not defined it returns the entire array value. Returns interface{} the element value or value of the array when index is not defined.

func (*AnyValueMap) GetAsString

func (c *AnyValueMap) GetAsString(key string) string

Converts map element into a string or returns "" if conversion is not possible. see getAsStringWithDefault Parameters:

  • key string a key of element to get.

Returns string string value of the element or "" if conversion is not supported.

func (*AnyValueMap) GetAsStringWithDefault

func (c *AnyValueMap) GetAsStringWithDefault(key string, defaultValue string) string

Converts map element into a string or returns default value if conversion is not possible. see StringConverter.toStringWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue string the default value

Returns string string value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsType

func (c *AnyValueMap) GetAsType(typ convert.TypeCode, key string) interface{}

Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value for the specified type. see getAsTypeWithDefault Parameters:

  • type TypeCode the TypeCode that defined the type of the result
  • key string a key of element to get.

Returns interface{} element value defined by the typecode or default if conversion is not supported.

func (*AnyValueMap) GetAsTypeWithDefault

func (c *AnyValueMap) GetAsTypeWithDefault(typ convert.TypeCode, key string, defaultValue interface{}) interface{}

Converts map element into a value defined by specied typecode. If conversion is not possible it returns default value. see TypeConverter.toTypeWithDefault Parameters:

  • type TypeCode the TypeCode that defined the type of the result
  • key string a key of element to get. defaultValue interface{} the default value

Returns interface {} element value defined by the typecode or default value if conversion is not supported.

func (*AnyValueMap) GetAsUInteger added in v1.1.1

func (c *AnyValueMap) GetAsUInteger(key string) uint

Converts map element into an integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • key string a key of element to get.

Returns int integer value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsUIntegerWithDefault added in v1.1.1

func (c *AnyValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint

Converts map element into an integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • key string a key of element to get. -defaultValue int the default value

Returns int integer value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsULong added in v1.1.1

func (c *AnyValueMap) GetAsULong(key string) uint64

Converts map element into a unsigned long or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • key string a key of element to get.

Returns uint64 uint64 value of the element or 0 if conversion is not supported.

func (*AnyValueMap) GetAsULongWithDefault added in v1.1.1

func (c *AnyValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64

Converts map element into a unsigned long or returns default value if conversion is not possible. see LongConverter.toLongWithDefault Parameters:

-key string
a key of element to get.
- defaultValue int64
the default value

Returns uint64 uint64 value of the element or default value if conversion is not supported.

func (*AnyValueMap) GetAsValue

func (c *AnyValueMap) GetAsValue(key string) *AnyValue

Converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible. see AnyValue see AnyValue.constructor Parameters:

  • key string a key of element to get.

Returns *AnyValue AnyValue value of the element or empty AnyValue if conversion is not supported.

func (*AnyValueMap) InnerValue

func (c *AnyValueMap) InnerValue() interface{}

Return inner values of map as interface{}

func (*AnyValueMap) Keys

func (c *AnyValueMap) Keys() []string

Gets keys of all elements stored in this map. Returns []string a list with all map keys.

func (*AnyValueMap) Len

func (c *AnyValueMap) Len() int

Gets a number of elements stored in this map. Returns int the number of elements in this map.

func (*AnyValueMap) Put

func (c *AnyValueMap) Put(key string, value interface{})

Puts a new value into map element specified by its key. Parameters:

  • key string a key of the element to put.
  • value interface{} a new value for map element.

Returns interface{}

func (*AnyValueMap) Remove

func (c *AnyValueMap) Remove(key string)

Removes a map element specified by its key Parameters:

  • key string a key of the element to remove.

func (*AnyValueMap) SetAsObject

func (c *AnyValueMap) SetAsObject(key string, value interface{})

func (*AnyValueMap) SetAsSingleObject

func (c *AnyValueMap) SetAsSingleObject(value interface{})

Sets a new value to map. see ArrayConverter.toMap Parameters:

  • value interface{}

a new element or array value.

func (*AnyValueMap) String

func (c *AnyValueMap) String() string

Gets a string representation of the object. The result is a semicolon-separated list of key-value pairs as "key1=value1;key2=value2;key=value3" Returns string a string representation of the object.

func (*AnyValueMap) Value

func (c *AnyValueMap) Value() map[string]interface{}

Returns map of elements as map[string]interface{}

type DataPage

type DataPage struct {
	Total *int64        `json:"total"`
	Data  []interface{} `json:"data"`
}

Data transfer object that is used to pass results of paginated queries. It contains items of retrieved page and optional total number of items. Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by PagingParams object. The skip parameter in the PagingParams there means how many items to skip. The takes parameter sets number of items to return in the page. And the optional total parameter tells to return total number of items in the query. Remember: not all implementations support the total parameter because its generation may lead to severe performance implications. see PagingParams

Example:

err, page = myDataClient.getDataByFilter(
    "123",
    FilterParams.fromTuples("completed": true),
    NewPagingParams(0, 100, true)
	};

	if err != nil {
		panic()
	}
	for item range page.Data {
        fmt.Println(item);
    }
);

func NewDataPage

func NewDataPage(total *int64, data []interface{}) *DataPage

Creates a new instance of data page and assigns its values. Parameters:

  • value data []interface{} a list of items from the retrieved page.
  • total int64

Returns *DataPage

func NewEmptyDataPage

func NewEmptyDataPage() *DataPage

Creates a new empty instance of data page. Returns *DataPage

func NewEmptyTokenizedDataPage added in v1.1.0

func NewEmptyTokenizedDataPage() *DataPage

Creates a new empty instance of data page. Returns *TokenizedDataPage

type FilterParams

type FilterParams struct {
	StringValueMap
}

Data transfer object used to pass filter parameters as simple key-value pairs. see StringValueMap

Example:

filter := NewFilterParamsFromTuples(
    "type", "Type1",
    "from_create_time", new Date(2000, 0, 1),
    "to_create_time", new Date(),
    "completed", true
);
paging = NewPagingParams(0, 100);

err, page = myDataClient.getDataByFilter(filter, paging);

func NewEmptyFilterParams

func NewEmptyFilterParams() *FilterParams

Creates a new instance. Returns *FilterParams

func NewFilterParams

func NewFilterParams(values map[string]string) *FilterParams

Creates a new instance and initalizes it with elements from the specified map. Parameters:

  • value map[string]string a map to initialize this instance.

Returns *FilterParams

func NewFilterParamsFromString

func NewFilterParamsFromString(line string) *FilterParams

Parses semicolon-separated key-value pairs and returns them as a FilterParams. see StringValueMap.FromString Parameters:

  • line string semicolon-separated key-value list to initialize FilterParams.

Returns *FilterParams

func NewFilterParamsFromTuples

func NewFilterParamsFromTuples(tuples ...interface{}) *FilterParams

Creates a new FilterParams from a list of key-value pairs called tuples. Parameters:

  • tuples ...interface{} a list of values where odd elements are keys and the following even elements are values

Returns *FilterParams a newly created FilterParams.

func NewFilterParamsFromValue

func NewFilterParamsFromValue(value interface{}) *FilterParams

Converts specified value into FilterParams. Parameters:

  • value interface

value to be converted Returns FilterParams a newly created FilterParams.

type ICloneable

type ICloneable interface {
	// Creates a binary clone of this object.
	// returns: a clone of this object.
	Clone() interface{}
}

Interface for data objects that are able to create their full binary copy.

### Example ###

type MyStruct struct {
	...
}

func (c MyStruct) Clone() interface{} {
	cloneObj := new(MyStruct)
	// Copy every attribute from this to cloneObj here.
	...
	return cloneObj
}

type IEquatable

type IEquatable interface {
	Equals(value interface{}) bool
}

type IMap

type IMap interface {
	Get(key string) interface{}
	Put(key string, value interface{})
	Remove(key string)
	Contains(key string) bool
}

type MultiString

type MultiString map[string]string

An object that contains string translations for multiple languages. Language keys use two-letter codes like: 'en', 'sp', 'de', 'ru', 'fr', 'pr'. When translation for specified language does not exists it defaults to English ('en'). When English does not exists it falls back to the first defined language.

Example:

values := MultiString.fromTuples(
    "en", "Hello World!",
    "ru", "Привет мир!"
);

value1 := values.get('ru'); // Result: "Привет мир!"
value2 := values.get('pt'); // Result: "Hello World!"

type PagingParams

type PagingParams struct {
	Skip  *int64 `json:"skip"`
	Take  *int64 `json:"take"`
	Total bool   `json:"total"`
}

Data transfer object to pass paging parameters for queries.

The page is defined by two parameters:

the skip parameter defines number of items to skip. the take parameter sets how many items to return in a page. additionally, the optional total parameter tells to return total number of items in the query. Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

Example:

filter := NewFilterParamsFromTuples("type", "Type1");
paging := NewPagingParams(0, 100);

err, page = myDataClient.getDataByFilter(filter, paging);

func NewEmptyPagingParams

func NewEmptyPagingParams() *PagingParams

Creates a new instance. Returns *PagingParams

func NewPagingParams

func NewPagingParams(skip, take, total interface{}) *PagingParams

Creates a new instance and sets its values. Parameters: - skip interface{} the number of items to skip. - take interface{} the number of items to return. - total interface{} true to return the total number of items. Returns *PagingParams

func NewPagingParamsFromMap

func NewPagingParamsFromMap(value *AnyValueMap) *PagingParams

Creates a new PagingParams and sets it parameters from the specified map Parameters:

  • value AnyValueMap a AnyValueMap or StringValueMap to initialize this PagingParams

Returns *PagingParams a newly created PagingParams.

func NewPagingParamsFromTuples

func NewPagingParamsFromTuples(tuples ...interface{}) *PagingParams

Creates a new PagingParams from a list of key-value pairs called tuples. Parameters

  • tuples ...interface{} a list of values where odd elements are keys and the following even elements are values

Returns *PagingParams a newly created PagingParams.

func NewPagingParamsFromValue

func NewPagingParamsFromValue(value interface{}) *PagingParams

Converts specified value into PagingParams. Parameters:

  • value interface{} value to be converted

Returns *PagingParams a newly created PagingParams.

func (*PagingParams) GetSkip

func (c *PagingParams) GetSkip(minSkip int64) int64

Gets the number of items to skip. Parameters:

  • minSkip int64 the minimum number of items to skip.

Returns int64 the number of items to skip.

func (*PagingParams) GetTake

func (c *PagingParams) GetTake(maxTake int64) int64

Gets the number of items to return in a page. Parameters:

  • maxTake int64 the maximum number of items to return.

Returns int64 the number of items to return.

type ProjectionParams

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

Defines projection parameters with list if fields to include into query results. The parameters support two formats: dot format and nested format. The dot format is the standard way to define included fields and subfields using dot object notation: "field1,field2.field21,field2.field22.field221". As alternative the nested format offers a more compact representation: "field1,field2(field21,field22(field221))".

Example:

filter := NewFilterParamsFromTuples("type", "Type1");
paging := NewPagingParams(0, 100);
projection = NewProjectionParamsFromString("field1,field2(field21,field22)")

err, page := myDataClient.getDataByFilter(filter, paging, projection);

func NewEmptyProjectionParams

func NewEmptyProjectionParams() *ProjectionParams

Creates a new instance of the projection parameters and assigns its value. Returns *ProjectionParams

func NewProjectionParamsFromAnyArray

func NewProjectionParamsFromAnyArray(values *AnyValueArray) *ProjectionParams

Creates a new instance of the projection parameters and assigns its from AnyValueArray values. Parameters:

  • values *AnyValueArray

Returns *ProjectionParams

func NewProjectionParamsFromStrings

func NewProjectionParamsFromStrings(values []string) *ProjectionParams

Creates a new instance of the projection parameters and assigns its from string value. Parameters:

  • values []string

Returns *ProjectionParams

func NewProjectionParamsFromValue

func NewProjectionParamsFromValue(value interface{}) *ProjectionParams

Converts specified value into ProjectionParams. see AnyValueArray.fromValue Parameters:

  • value interface{} value to be converted

Returns *ProjectionParams a newly created ProjectionParams.

func ParseProjectionParams

func ParseProjectionParams(values ...string) *ProjectionParams

Create new ProjectionParams and set values from values Parameters:

  • values ...string an values to parce

Return *ProjectionParams

func (*ProjectionParams) Append

func (c *ProjectionParams) Append(elements []string)

Appends new elements to an array. Parameters:

  • value []string

func (*ProjectionParams) Clear

func (c *ProjectionParams) Clear()

Clear elements

func (*ProjectionParams) Get

func (c *ProjectionParams) Get(index int) string

Get value by index Parameters:

  • index int an index of element

Return string

func (*ProjectionParams) Len

func (c *ProjectionParams) Len() int

Gets or sets the length of the array. This is a number one higher than the highest element defined in an array.

func (*ProjectionParams) Push

func (c *ProjectionParams) Push(value string)

Appends new element to an array. Parameters:

  • value string

func (*ProjectionParams) Put

func (c *ProjectionParams) Put(index int, value string)

Set value in index position Parameters:

  • index int an index of element
  • value string value

func (*ProjectionParams) Remove

func (c *ProjectionParams) Remove(index int)

Remove element by index Parameters:

  • index int an index of remove element

func (*ProjectionParams) String

func (c *ProjectionParams) String() string

Returns a string representation of an array. Returns string

func (*ProjectionParams) Value

func (c *ProjectionParams) Value() []string

Return raw values []string

type SortField

type SortField struct {
	Name      string `json:"name"`
	Ascending bool   `json:"ascending"`
}

Defines a field name and order used to sort query results. see SortParams

Example:

filter := NewFilterParamsFromTuples("type", "Type1");
paging := NewPagingParams(0, 100);
sorting := NewSortingParams(NewSortField("create_time", true));

err, page = myDataClient.getDataByFilter(filter, paging, sorting);

func NewEmptySortField

func NewEmptySortField() SortField

Creates a new empty instance. Returns SortField

func NewSortField

func NewSortField(name string, ascending bool) SortField

Creates a new instance and assigns its values. Parameters:

  • name string the name of the field to sort by.
  • ascending: bool true to sort in ascending order, and false to sort in descending order.

Returns SortField

type SortParams

type SortParams []SortField

func NewEmptySortParams

func NewEmptySortParams() *SortParams

Creates a new instance. Returns *SortParams

func NewSortParams

func NewSortParams(fields []SortField) *SortParams

Creates a new instance and initializes it with specified sort fields. Parameters

  • fields []SortField a list of fields to sort by.

Returns *SortParams

type StringValueMap

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

func NewEmptyStringValueMap

func NewEmptyStringValueMap() *StringValueMap

Creates a new instance of the map.

func NewStringValueMap

func NewStringValueMap(value map[string]string) *StringValueMap

Creates a new instance of the map and assigns its value. Parameters

  • value map[string]string

Returns *StringValueMap

func NewStringValueMapFromMaps

func NewStringValueMapFromMaps(maps ...map[string]string) *StringValueMap

Creates a new AnyValueMap by merging two or more maps. Maps defined later in the list override values from previously defined maps. Parameters:

  • maps...map[string]string an array of maps to be merged

Returns StringValueMap a newly created AnyValueMap.

func NewStringValueMapFromString

func NewStringValueMapFromString(line string) *StringValueMap

Parses semicolon-separated key-value pairs and returns them as a StringValueMap. Parameters:

  • line string semicolon-separated key-value list to initialize StringValueMap.

Returns *StringValueMap a newly created StringValueMap.

func NewStringValueMapFromTuples

func NewStringValueMapFromTuples(tuples ...interface{}) *StringValueMap

func NewStringValueMapFromTuplesArray

func NewStringValueMapFromTuplesArray(tuples []interface{}) *StringValueMap

Creates a new StringValueMap from a list of key-value pairs called tuples. The method is similar to fromTuples but tuples are passed as array instead of parameters. Parameters:

  • tuples: []interface{} a list of values where odd elements are keys and the following even elements are values

Returns *StringValueMap a newly created StringValueMap.

func NewStringValueMapFromValue

func NewStringValueMapFromValue(value interface{}) *StringValueMap

Converts specified value into StringValueMap. see setAsObject Parameters:

  • value interface{} value to be converted

Returns *StringValueMap a newly created StringValueMap.

func (*StringValueMap) Append

func (c *StringValueMap) Append(values map[string]string)

Appends new elements to this map. Parameters:

  • values map[string]string a map with elements to be added.

func (*StringValueMap) AppendAny

func (c *StringValueMap) AppendAny(values map[string]interface{})

Appends new elements to this map. Parameters:

  • values map[string]interface{} a map with elements to be added.

func (*StringValueMap) Clear

func (c *StringValueMap) Clear()

Clears this map by removing all its elements.

func (*StringValueMap) Clone

func (c *StringValueMap) Clone() interface{}

Creates a binary clone of this object. Returns interface{} a clone of this object.

func (*StringValueMap) Contains

func (c *StringValueMap) Contains(key string) bool

Checks if this map contains a key. The check uses direct comparison between key and the specified key value. Parameters

  • key string a value to be checked

Returns bool true if this map contains the key or false otherwise.

func (*StringValueMap) Get

func (c *StringValueMap) Get(key string) string

Gets a map element specified by its key. Parameters:

-key string
a key of the element to get.

Returns string the value of the map element.

func (*StringValueMap) GetAsArray

func (c *StringValueMap) GetAsArray(key string) *AnyValueArray

Converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible. see AnyValueArray see AnyValueArray.fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueArray AnyValueArray value of the element or empty AnyValueArray if conversion is not supported.

func (*StringValueMap) GetAsArrayWithDefault

func (c *StringValueMap) GetAsArrayWithDefault(key string, defaultValue *AnyValueArray) *AnyValueArray

Converts map element into an AnyValueArray or returns default value if conversion is not possible. see AnyValueArray see getAsNullableArray Parameters

  • key string a key of element to get.
  • defaultValue *AnyValueArray the default value

Returns *AnyValueArray AnyValueArray value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsBoolean

func (c *StringValueMap) GetAsBoolean(key string) bool

Converts map element into a boolean or returns false if conversion is not possible. see getAsBooleanWithDefault Parameters:

  • key string a key of element to get.

Returns bool boolean value of the element or false if conversion is not supported.

func (*StringValueMap) GetAsBooleanWithDefault

func (c *StringValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool

Converts map element into a boolean or returns default value if conversion is not possible. see BooleanConverter.toBooleanWithDefault Parameters

  • key string a key of element to get.
  • defaultValue bool the default value

Returns bool boolean value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsDateTime

func (c *StringValueMap) GetAsDateTime(key string) time.Time

Converts map element into a time.Time or returns the current date if conversion is not possible. see getAsDateTimeWithDefault Parameters:

  • key string a key of element to get.

Returns time.Time time.Time value of the element or the current date if conversion is not supported.

func (*StringValueMap) GetAsDateTimeWithDefault

func (c *StringValueMap) GetAsDateTimeWithDefault(key string, defaultValue time.Time) time.Time

func (*StringValueMap) GetAsDouble

func (c *StringValueMap) GetAsDouble(key string) float64

Converts map element into a float64 or returns 0 if conversion is not possible. see getAsDoubleWithDefault Parameters:

  • key string a key of element to get.

Returns float64 float64 value of the element or 0 if conversion is not supported.

func (*StringValueMap) GetAsDoubleWithDefault

func (c *StringValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64

Converts map element into a float64 or returns default value if conversion is not possible. see DoubleConverter.toDoubleWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue float64 the default value

Returns float64 float64 value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsFloat

func (c *StringValueMap) GetAsFloat(key string) float32

Converts map element into a float32 or returns 0 if conversion is not possible. see getAsFloatWithDefault Parameters:

  • key string a key of element to get.

Returns float32 float32 value of the element or 0 if conversion is not supported.

func (*StringValueMap) GetAsFloatWithDefault

func (c *StringValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32

Converts map element into a float32 or returns default value if conversion is not possible. see FloatConverter.toFloatWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue: float32 the default value

Returns float32 float32 value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsInteger

func (c *StringValueMap) GetAsInteger(key string) int

Converts map element into an integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • key string a key of element to get.

Returns int

func (*StringValueMap) GetAsIntegerWithDefault

func (c *StringValueMap) GetAsIntegerWithDefault(key string, defaultValue int) int

Converts map element into an integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue int the default value

Returns int integer value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsLong

func (c *StringValueMap) GetAsLong(key string) int64

Converts map element into a uint64 or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • key string a key of element to get.

Returns int64 loint64ng value of the element or 0 if conversion is not supported.

func (*StringValueMap) GetAsLongWithDefault

func (c *StringValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64

Converts map element into a int64 or returns default value if conversion is not possible. see LongConverter.toLongWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue int64 the default value

Returns int64 int64 value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsMap

func (c *StringValueMap) GetAsMap(key string) *AnyValueMap

Converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible. see fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueMap AnyValueMap value of the element or empty AnyValueMap if conversion is not supported.

func (*StringValueMap) GetAsMapWithDefault

func (c *StringValueMap) GetAsMapWithDefault(key string, defaultValue *AnyValueMap) *AnyValueMap

Converts map element into an AnyValueMap or returns default value if conversion is not possible. see getAsNullableMap Parameters:

  • key string a key of element to get. defaultValue *AnyValueMap the default value

Returns *AnyValueMap AnyValueMap value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsNullableArray

func (c *StringValueMap) GetAsNullableArray(key string) *AnyValueArray

Converts map element into an AnyValueArray or returns null if conversion is not possible. see AnyValueArray see AnyValueArray.fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueArray AnyValueArray value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableBoolean

func (c *StringValueMap) GetAsNullableBoolean(key string) *bool

Converts map element into a boolean or returns null if conversion is not possible. see BooleanConverter.toNullableBoolean Parameters:

  • key string a key of element to get.

Returns *bool boolean value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableDateTime

func (c *StringValueMap) GetAsNullableDateTime(key string) *time.Time

Converts map element into a time.Time or returns null if conversion is not possible. see DateTimeConverter.toNullableDateTime Parameters:

  • key string a key of element to get.

Returns time.Time time.Time value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableDouble

func (c *StringValueMap) GetAsNullableDouble(key string) *float64

Converts map element into a float64 or returns null if conversion is not possible. see DoubleConverter.toNullableDouble Parameters:

  • key string a key of element to get.

Returns *float64 float64 value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableFloat

func (c *StringValueMap) GetAsNullableFloat(key string) *float32

Converts map element into a float32 or returns null if conversion is not possible. see FloatConverter.toNullableFloat Parameters:

  • key string a key of element to get.

Returns *float32 float32 value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableInteger

func (c *StringValueMap) GetAsNullableInteger(key string) *int

Converts map element into an integer or returns null if conversion is not possible. see IntegerConverter.toNullableInteger Parameters:

  • key string a key of element to get.

Returns *int integer value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableLong

func (c *StringValueMap) GetAsNullableLong(key string) *int64

Converts map element into a int64 or returns null if conversion is not possible. see LongConverter.toNullableLong Parameters:

  • key string a key of element to get.

Returns *int64 int64 value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableMap

func (c *StringValueMap) GetAsNullableMap(key string) *AnyValueMap

Converts map element into an AnyValueMap or returns null if conversion is not possible. see fromValue Parameters:

  • key string a key of element to get.

Returns *AnyValueMap AnyValueMap value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableString

func (c *StringValueMap) GetAsNullableString(key string) *string

Converts map element into a string or returns null if conversion is not possible. see StringConverter.toNullableString Parameters:

  • key string a key of element to get.

Returns *string string value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableUInteger added in v1.1.1

func (c *StringValueMap) GetAsNullableUInteger(key string) *uint

Converts map element into an unsigned integer or returns null if conversion is not possible. see IntegerConverter.toNullableInteger Parameters:

  • key string a key of element to get.

Returns *int integer value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsNullableULong added in v1.1.1

func (c *StringValueMap) GetAsNullableULong(key string) *uint64

Converts map element into a uint64 or returns null if conversion is not possible. see LongConverter.toNullableLong Parameters:

  • key string a key of element to get.

Returns *uint64 int64 value of the element or null if conversion is not supported.

func (*StringValueMap) GetAsObject

func (c *StringValueMap) GetAsObject(key string) interface{}

Gets the value stored in map element without any conversions. When element key is not defined it returns the entire map value. Parameters:

  • key string a key of the element to get

Returns interface{} the element value or value of the map when index is not defined.

func (*StringValueMap) GetAsSingleObject

func (c *StringValueMap) GetAsSingleObject() interface{}

Gets the value stored in map element without any conversions. When element index is not defined it returns the entire array value. Returns interface{} the element value or value of the array when index is not defined.

func (*StringValueMap) GetAsString

func (c *StringValueMap) GetAsString(key string) string

Converts map element into a string or returns "" if conversion is not possible. see getAsStringWithDefault Parameters:

  • key string a key of element to get.

Returns string string value of the element or "" if conversion is not supported.

func (*StringValueMap) GetAsStringWithDefault

func (c *StringValueMap) GetAsStringWithDefault(key string, defaultValue string) string

Converts map element into a string or returns default value if conversion is not possible. see StringConverter.toStringWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue string the default value

Returns string string value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsUInteger added in v1.1.1

func (c *StringValueMap) GetAsUInteger(key string) uint

Converts map element into an unsigned integer or returns 0 if conversion is not possible. see getAsIntegerWithDefault Parameters:

  • key string a key of element to get.

Returns int

func (*StringValueMap) GetAsUIntegerWithDefault added in v1.1.1

func (c *StringValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint

Converts map element into an unsigned integer or returns default value if conversion is not possible. see IntegerConverter.toIntegerWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue int the default value

Returns int integer value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsULong added in v1.1.1

func (c *StringValueMap) GetAsULong(key string) uint64

Converts map element into a uint64 or returns 0 if conversion is not possible. see getAsLongWithDefault Parameters:

  • key string a key of element to get.

Returns uint64 loint64ng value of the element or 0 if conversion is not supported.

func (*StringValueMap) GetAsULongWithDefault added in v1.1.1

func (c *StringValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64

Converts map element into a uint64 or returns default value if conversion is not possible. see LongConverter.toLongWithDefault Parameters:

  • key string a key of element to get.
  • defaultValue uint64 the default value

Returns uint64 uint64 value of the element or default value if conversion is not supported.

func (*StringValueMap) GetAsValue

func (c *StringValueMap) GetAsValue(key string) *AnyValue

Converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible. see AnyValue Parameters:

  • key string a key of element to get.

Returns *AnyValue AnyValue value of the element or empty AnyValue if conversion is not supported.

func (*StringValueMap) InnerValue

func (c *StringValueMap) InnerValue() interface{}

Return inner values of map as interface{}

func (*StringValueMap) Keys

func (c *StringValueMap) Keys() []string

Gets keys of all elements stored in this map. Returns []string a list with all map keys.

func (*StringValueMap) Len

func (c *StringValueMap) Len() int

Gets a number of elements stored in this map. Returns int the number of elements in this map.

func (*StringValueMap) MarshalJSON

func (c *StringValueMap) MarshalJSON() ([]byte, error)

func (*StringValueMap) Put

func (c *StringValueMap) Put(key string, value interface{})

Puts a new value into map element specified by its key. Parameters:

  • key string a key of the element to put.
  • value interface{}

a new value for map element. Returns interface{}

func (*StringValueMap) Remove

func (c *StringValueMap) Remove(key string)

Removes a map element specified by its key Parameters:

  • key string a key of the element to remove.

func (*StringValueMap) SetAsObject

func (c *StringValueMap) SetAsObject(key string, value interface{})

Sets a new value to map element specified by its index. When the index is not defined, it resets the entire map value. This method has double purpose because method overrides are not supported in JavaScript. see MapConverter.toMap Parameters:

  • key any a key of the element to set
  • value interface{}

a new element or map value.

func (*StringValueMap) SetAsSingleObject

func (c *StringValueMap) SetAsSingleObject(value interface{})

Sets a new value to map. Parameters:

  • value interface{}

a new element or array value.

func (*StringValueMap) String

func (c *StringValueMap) String() string

Gets a string representation of the object. The result is a semicolon-separated

list of key-value pairs as "key1=value1;key2=value2;key=value3"

Returns string a string representation of the object.

func (*StringValueMap) UnmarshalJSON

func (c *StringValueMap) UnmarshalJSON(data []byte) error

func (*StringValueMap) Value

func (c *StringValueMap) Value() map[string]string

Returns map of elements as map[string]interface{}

type TIdGenerator

type TIdGenerator struct{}

Helper class to generate unique object IDs. It supports two types of IDs: long and short. Long IDs are string GUIDs. They are globally unique and 32-character long. ShortIDs are just 9-digit random numbers. They are not guaranteed be unique. Example:

IdGenerator.NextLong();      // Possible result: "234ab342c56a2b49c2ab42bf23ff991ac"
IdGenerator.NextShort();     // Possible result: "23495247"
var IdGenerator *TIdGenerator = &TIdGenerator{}

func (*TIdGenerator) NextLong

func (c *TIdGenerator) NextLong() string

Generates a globally unique 32-digit object ID. The value is a string representation of a GUID value. Returns string a generated 32-digit object ID

func (*TIdGenerator) NextShort

func (c *TIdGenerator) NextShort() string

Generates a random 9-digit random ID (code). Remember: The returned value is not guaranteed to be unique. Returns string a generated random 9-digit code

type TTagsProcessor

type TTagsProcessor struct{}

Helper class to extract and process search tags from objects. The search tags can be kept individually or embedded as hash tags inside text like "This text has #hash_tag that can be used for search."

var TagsProcessor *TTagsProcessor = &TTagsProcessor{}

func (*TTagsProcessor) CompressTag

func (c *TTagsProcessor) CompressTag(tag string) string

Compress a tag by removing special symbols like spaces, '_' and '#' and converting the tag to lower case. When tags are compressed they can be matched in search queries. Parameters:

  • tag string the tag to compress.

Returns string a compressed tag.

func (*TTagsProcessor) CompressTagList

func (c *TTagsProcessor) CompressTagList(tagList string) []string

Compresses a comma-separated list of tags. Parameters:

  • tagList string a comma-separated list of tags to compress.

Returns []string a list with compressed tags.

func (*TTagsProcessor) CompressTags

func (c *TTagsProcessor) CompressTags(tags []string) []string

Compresses a list of tags. Parameters

  • tags []string the tags to compress.

Returns []string a list with normalized tags.

func (*TTagsProcessor) EqualTags

func (c *TTagsProcessor) EqualTags(tag1 string, tag2 string) bool

Compares two tags using their compressed form. Parameters:

  • tag1 string the first tag.
  • tag2 string the second tag.

Returns bool true if the tags are equal and false otherwise.

func (*TTagsProcessor) ExtractHashTags

func (c *TTagsProcessor) ExtractHashTags(text string) []string

Extracts hash tags from a text. Parameters:

  • text string a text that contains hash tags

Returns []string a list with extracted and compressed tags.

func (*TTagsProcessor) NormalizeTag

func (c *TTagsProcessor) NormalizeTag(tag string) string

Normalizes a tag by replacing special symbols like '_' and '#' with spaces. When tags are normalized then can be presented to user in similar shape and form. Parameters:

  • tag string the tag to normalize.

Returns string a normalized tag.

func (*TTagsProcessor) NormalizeTagList

func (c *TTagsProcessor) NormalizeTagList(tagList string) []string

Normalizes a comma-separated list of tags. Parameters

  • tagList string a comma-separated list of tags to normalize.

Returns []string a list with normalized tags.

func (*TTagsProcessor) NormalizeTags

func (c *TTagsProcessor) NormalizeTags(tags []string) []string

type TokenizedDataPage added in v1.1.0

type TokenizedDataPage struct {
	Token string        `json:"token"`
	Data  []interface{} `json:"data"`
}

Data transfer object that is used to pass results of paginated queries. It contains items of retrieved page and optional total number of items. Most often this object type is used to send responses to paginated queries. Pagination parameters are defined by TokenizedPagingParams object. The token parameter in the TokenizedPagingParams there determines a starting point for a new search. It is received in the TokenizedDataPage from the previous search. The takes parameter sets number of items to return in the page. And the optional total parameter tells to return total number of items in the query. Remember: not all implementations support the total parameter because its generation may lead to severe performance implications. see TokenizedPagingParams

Example:

   err, page = myDataClient.getDataByFilter(
     "123",
     FilterParams.fromTuples("completed": true),
     NewTokenizedPagingParams("", 100, true)
   };

	if err != nil {
		panic()
	}
	for item range page.Data {
        fmt.Println(item);
    }
);

func NewTokenizedDataPage added in v1.1.0

func NewTokenizedDataPage(token string, data []interface{}) *TokenizedDataPage

Creates a new instance of data page and assigns its values. Parameters:

  • token a token that defines a starting point for next search
  • data []interface{} a list of items from the retrieved page.

Returns *TokenizedDataPage

type TokenizedPagingParams added in v1.1.0

type TokenizedPagingParams struct {
	Token string `json:"token"`
	Take  *int64 `json:"take"`
	Total bool   `json:"total"`
}

Data transfer object to pass paging parameters for queries.

The page is defined by two parameters:

the token parameter a starting point for a new page. The token shall be received from previous searches. the take parameter sets how many items to return in a page. additionally, the optional total parameter tells to return total number of items in the query. Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

Example:

filter := NewFilterParamsFromTuples("type", "Type1");
paging := NewTokenizedPagingParams("", 100);

err, page = myDataClient.getDataByFilter(filter, paging);

func NewEmptyTokenizedPagingParams added in v1.1.0

func NewEmptyTokenizedPagingParams() *TokenizedPagingParams

Creates a new instance. Returns *TokenizedPagingParams

func NewTokenizedPagingParams added in v1.1.0

func NewTokenizedPagingParams(token, take, total interface{}) *TokenizedPagingParams

Creates a new instance and sets its values. Parameters:

  • token string a token received from previous searches to define a starting point for this search.
  • take interface{} the number of items to return.
  • total interface{} true to return the total number of items.

Returns *TokenizedPagingParams

func NewTokenizedPagingParamsFromMap added in v1.1.0

func NewTokenizedPagingParamsFromMap(value *AnyValueMap) *TokenizedPagingParams

Creates a new TokenizedPagingParams and sets it parameters from the specified map Parameters:

  • value AnyValueMap a AnyValueMap or StringValueMap to initialize this TokenizedPagingParams

Returns *TokenizedPagingParams a newly created TokenizedPagingParams.

func NewTokenizedPagingParamsFromTuples added in v1.1.0

func NewTokenizedPagingParamsFromTuples(tuples ...interface{}) *TokenizedPagingParams

Creates a new TokenizedPagingParams from a list of key-value pairs called tuples. Parameters

  • tuples ...interface{} a list of values where odd elements are keys and the following even elements are values

Returns *TokenizedPagingParams a newly created TokenizedPagingParams.

func NewTokenizedPagingParamsFromValue added in v1.1.0

func NewTokenizedPagingParamsFromValue(value interface{}) *TokenizedPagingParams

Converts specified value into TokenizedPagingParams. Parameters:

  • value interface{} value to be converted

Returns *PagingParams a newly created PagingParams.

func (*TokenizedPagingParams) GetTake added in v1.1.0

func (c *TokenizedPagingParams) GetTake(maxTake int64) int64

Gets the number of items to return in a page. Parameters:

  • maxTake int64 the maximum number of items to return.

Returns int64 the number of items to return.

Jump to

Keyboard shortcuts

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