Documentation ¶
Index ¶
- type AnyValue
- func (c *AnyValue) Clone() *AnyValue
- func (c *AnyValue) Equals(obj any) bool
- func (c *AnyValue) EqualsAsType(typ convert.TypeCode, obj any) bool
- func (c *AnyValue) GetAsArray() *AnyValueArray
- func (c *AnyValue) GetAsBoolean() bool
- func (c *AnyValue) GetAsBooleanWithDefault(defaultValue bool) bool
- func (c *AnyValue) GetAsDateTime() time.Time
- func (c *AnyValue) GetAsDateTimeWithDefault(defaultValue time.Time) time.Time
- func (c *AnyValue) GetAsDouble() float64
- func (c *AnyValue) GetAsDoubleWithDefault(defaultValue float64) float64
- func (c *AnyValue) GetAsDuration() time.Duration
- func (c *AnyValue) GetAsDurationWithDefault(defaultValue time.Duration) time.Duration
- func (c *AnyValue) GetAsFloat() float32
- func (c *AnyValue) GetAsFloatWithDefault(defaultValue float32) float32
- func (c *AnyValue) GetAsInteger() int
- func (c *AnyValue) GetAsIntegerWithDefault(defaultValue int) int
- func (c *AnyValue) GetAsLong() int64
- func (c *AnyValue) GetAsLongWithDefault(defaultValue int64) int64
- func (c *AnyValue) GetAsMap() *AnyValueMap
- func (c *AnyValue) GetAsNullableBoolean() (bool, bool)
- func (c *AnyValue) GetAsNullableDateTime() (time.Time, bool)
- func (c *AnyValue) GetAsNullableDouble() (float64, bool)
- func (c *AnyValue) GetAsNullableDuration() (time.Duration, bool)
- func (c *AnyValue) GetAsNullableFloat() (float32, bool)
- func (c *AnyValue) GetAsNullableInteger() (int, bool)
- func (c *AnyValue) GetAsNullableLong() (int64, bool)
- func (c *AnyValue) GetAsNullableString() (string, bool)
- func (c *AnyValue) GetAsNullableType(typ convert.TypeCode) (any, bool)
- func (c *AnyValue) GetAsNullableUInteger() (uint, bool)
- func (c *AnyValue) GetAsNullableULong() (uint64, bool)
- func (c *AnyValue) GetAsObject() any
- func (c *AnyValue) GetAsString() string
- func (c *AnyValue) GetAsStringWithDefault(defaultValue string) string
- func (c *AnyValue) GetAsType(typ convert.TypeCode) any
- func (c *AnyValue) GetAsTypeWithDefault(typ convert.TypeCode, defaultValue any) any
- func (c *AnyValue) GetAsUInteger() uint
- func (c *AnyValue) GetAsUIntegerWithDefault(defaultValue uint) uint
- func (c *AnyValue) GetAsULong() uint64
- func (c *AnyValue) GetAsULongWithDefault(defaultValue uint64) uint64
- func (c *AnyValue) InnerValue() any
- func (c *AnyValue) SetAsObject(value any)
- func (c *AnyValue) String() string
- func (c *AnyValue) TypeCode() convert.TypeCode
- func (c *AnyValue) Value() any
- type AnyValueArray
- func NewAnyValueArray(values []any) *AnyValueArray
- func NewAnyValueArrayFromString(values string, separator string, removeDuplicates bool) *AnyValueArray
- func NewAnyValueArrayFromValue(value any) *AnyValueArray
- func NewAnyValueArrayFromValues(values ...any) *AnyValueArray
- func NewEmptyAnyValueArray() *AnyValueArray
- func (c *AnyValueArray) Append(elements []any)
- func (c *AnyValueArray) Clear()
- func (c *AnyValueArray) Clone() *AnyValueArray
- func (c *AnyValueArray) Contains(value any) bool
- func (c *AnyValueArray) ContainsAsType(typ convert.TypeCode, value any) bool
- func (c *AnyValueArray) Get(index int) (any, bool)
- func (c *AnyValueArray) GetAsArray(index int) *AnyValueArray
- func (c *AnyValueArray) GetAsArrayWithDefault(index int, defaultValue *AnyValueArray) *AnyValueArray
- func (c *AnyValueArray) GetAsBoolean(index int) bool
- func (c *AnyValueArray) GetAsBooleanWithDefault(index int, defaultValue bool) bool
- func (c *AnyValueArray) GetAsDateTime(index int) time.Time
- func (c *AnyValueArray) GetAsDateTimeWithDefault(index int, defaultValue time.Time) time.Time
- func (c *AnyValueArray) GetAsDouble(index int) float64
- func (c *AnyValueArray) GetAsDoubleWithDefault(index int, defaultValue float64) float64
- func (c *AnyValueArray) GetAsDuration(index int) time.Duration
- func (c *AnyValueArray) GetAsDurationWithDefault(index int, defaultValue time.Duration) time.Duration
- func (c *AnyValueArray) GetAsFloat(index int) float32
- func (c *AnyValueArray) GetAsFloatWithDefault(index int, defaultValue float32) float32
- func (c *AnyValueArray) GetAsInteger(index int) int
- func (c *AnyValueArray) GetAsIntegerWithDefault(index int, defaultValue int) int
- func (c *AnyValueArray) GetAsLong(index int) int64
- func (c *AnyValueArray) GetAsLongWithDefault(index int, defaultValue int64) int64
- func (c *AnyValueArray) GetAsMap(index int) *AnyValueMap
- func (c *AnyValueArray) GetAsMapWithDefault(index int, defaultValue *AnyValueMap) *AnyValueMap
- func (c *AnyValueArray) GetAsNullableArray(index int) (*AnyValueArray, bool)
- func (c *AnyValueArray) GetAsNullableBoolean(index int) (bool, bool)
- func (c *AnyValueArray) GetAsNullableDateTime(index int) (time.Time, bool)
- func (c *AnyValueArray) GetAsNullableDouble(index int) (float64, bool)
- func (c *AnyValueArray) GetAsNullableDuration(index int) (time.Duration, bool)
- func (c *AnyValueArray) GetAsNullableFloat(index int) (float32, bool)
- func (c *AnyValueArray) GetAsNullableInteger(index int) (int, bool)
- func (c *AnyValueArray) GetAsNullableLong(index int) (int64, bool)
- func (c *AnyValueArray) GetAsNullableMap(index int) (*AnyValueMap, bool)
- func (c *AnyValueArray) GetAsNullableString(index int) (string, bool)
- func (c *AnyValueArray) GetAsNullableType(typ convert.TypeCode, index int) (any, bool)
- func (c *AnyValueArray) GetAsNullableUInteger(index int) (uint, bool)
- func (c *AnyValueArray) GetAsNullableULong(index int) (uint64, bool)
- func (c *AnyValueArray) GetAsObject(index int) (any, bool)
- func (c *AnyValueArray) GetAsSingleObject() any
- func (c *AnyValueArray) GetAsString(index int) string
- func (c *AnyValueArray) GetAsStringWithDefault(index int, defaultValue string) string
- func (c *AnyValueArray) GetAsType(typ convert.TypeCode, index int) any
- func (c *AnyValueArray) GetAsTypeWithDefault(typ convert.TypeCode, index int, defaultValue any) any
- func (c *AnyValueArray) GetAsUInteger(index int) uint
- func (c *AnyValueArray) GetAsUIntegerWithDefault(index int, defaultValue uint) uint
- func (c *AnyValueArray) GetAsULong(index int) uint64
- func (c *AnyValueArray) GetAsULongWithDefault(index int, defaultValue uint64) uint64
- func (c *AnyValueArray) GetAsValue(index int) (*AnyValue, bool)
- func (c *AnyValueArray) InnerValue() any
- func (c *AnyValueArray) IsValidIndex(index int) bool
- func (c *AnyValueArray) Len() int
- func (c *AnyValueArray) Push(value any)
- func (c *AnyValueArray) Put(index int, value any) bool
- func (c *AnyValueArray) Remove(index int) bool
- func (c *AnyValueArray) SetAsObject(index int, value any) bool
- func (c *AnyValueArray) SetAsSingleObject(value any)
- func (c *AnyValueArray) String() string
- func (c *AnyValueArray) Value() []any
- type AnyValueMap
- func InheritAnyValueMap(base IMap) *AnyValueMap
- func NewAnyValueMap(value map[string]any) *AnyValueMap
- func NewAnyValueMapFromMaps(maps ...map[string]any) *AnyValueMap
- func NewAnyValueMapFromTuples(tuples ...any) *AnyValueMap
- func NewAnyValueMapFromTuplesArray(tuples []any) *AnyValueMap
- func NewAnyValueMapFromValue(value any) *AnyValueMap
- func NewEmptyAnyValueMap() *AnyValueMap
- func (c *AnyValueMap) Append(value map[string]any)
- func (c *AnyValueMap) Clear()
- func (c *AnyValueMap) Clone() *AnyValueMap
- func (c *AnyValueMap) Contains(key string) bool
- func (c *AnyValueMap) Get(key string) (any, bool)
- func (c *AnyValueMap) GetAsArray(key string) *AnyValueArray
- func (c *AnyValueMap) GetAsArrayWithDefault(key string, defaultValue *AnyValueArray) *AnyValueArray
- func (c *AnyValueMap) GetAsBoolean(key string) bool
- func (c *AnyValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool
- func (c *AnyValueMap) GetAsDateTime(key string) time.Time
- func (c *AnyValueMap) GetAsDateTimeWithDefault(key string, defaultValue time.Time) time.Time
- func (c *AnyValueMap) GetAsDouble(key string) float64
- func (c *AnyValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64
- func (c *AnyValueMap) GetAsDuration(key string) time.Duration
- func (c *AnyValueMap) GetAsDurationWithDefault(key string, defaultValue time.Duration) time.Duration
- func (c *AnyValueMap) GetAsFloat(key string) float32
- func (c *AnyValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32
- func (c *AnyValueMap) GetAsInteger(key string) int
- func (c *AnyValueMap) GetAsIntegerWithDefault(key string, defaultValue int) int
- func (c *AnyValueMap) GetAsLong(key string) int64
- func (c *AnyValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64
- func (c *AnyValueMap) GetAsMap(key string) *AnyValueMap
- func (c *AnyValueMap) GetAsMapWithDefault(key string, defaultValue *AnyValueMap) *AnyValueMap
- func (c *AnyValueMap) GetAsNullableArray(key string) (*AnyValueArray, bool)
- func (c *AnyValueMap) GetAsNullableBoolean(key string) (bool, bool)
- func (c *AnyValueMap) GetAsNullableDateTime(key string) (time.Time, bool)
- func (c *AnyValueMap) GetAsNullableDouble(key string) (float64, bool)
- func (c *AnyValueMap) GetAsNullableDuration(key string) (time.Duration, bool)
- func (c *AnyValueMap) GetAsNullableFloat(key string) (float32, bool)
- func (c *AnyValueMap) GetAsNullableInteger(key string) (int, bool)
- func (c *AnyValueMap) GetAsNullableLong(key string) (int64, bool)
- func (c *AnyValueMap) GetAsNullableMap(key string) (*AnyValueMap, bool)
- func (c *AnyValueMap) GetAsNullableString(key string) (string, bool)
- func (c *AnyValueMap) GetAsNullableType(typ convert.TypeCode, key string) (any, bool)
- func (c *AnyValueMap) GetAsNullableUInteger(key string) (uint, bool)
- func (c *AnyValueMap) GetAsNullableULong(key string) (uint64, bool)
- func (c *AnyValueMap) GetAsObject(key string) (any, bool)
- func (c *AnyValueMap) GetAsSingleObject() any
- func (c *AnyValueMap) GetAsString(key string) string
- func (c *AnyValueMap) GetAsStringWithDefault(key string, defaultValue string) string
- func (c *AnyValueMap) GetAsType(typ convert.TypeCode, key string) any
- func (c *AnyValueMap) GetAsTypeWithDefault(typ convert.TypeCode, key string, defaultValue any) any
- func (c *AnyValueMap) GetAsUInteger(key string) uint
- func (c *AnyValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint
- func (c *AnyValueMap) GetAsULong(key string) uint64
- func (c *AnyValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64
- func (c *AnyValueMap) GetAsValue(key string) *AnyValue
- func (c *AnyValueMap) InnerValue() any
- func (c *AnyValueMap) Keys() []string
- func (c *AnyValueMap) Len() int
- func (c *AnyValueMap) Put(key string, value any)
- func (c *AnyValueMap) Remove(key string)
- func (c *AnyValueMap) SetAsObject(key string, value any)
- func (c *AnyValueMap) SetAsSingleObject(value any)
- func (c *AnyValueMap) String() string
- func (c *AnyValueMap) Value() map[string]any
- type ICloneable
- type IEquatable
- type IMap
- type StringValueMap
- func NewEmptyStringValueMap() *StringValueMap
- func NewStringValueMap(value map[string]string) *StringValueMap
- func NewStringValueMapFromMaps(maps ...map[string]string) *StringValueMap
- func NewStringValueMapFromString(line string) *StringValueMap
- func NewStringValueMapFromTuples(tuples ...any) *StringValueMap
- func NewStringValueMapFromTuplesArray(tuples []any) *StringValueMap
- func NewStringValueMapFromValue(value any) *StringValueMap
- func (c *StringValueMap) Append(values map[string]string)
- func (c *StringValueMap) AppendAny(values map[string]any)
- func (c *StringValueMap) Clear()
- func (c *StringValueMap) Clone() *StringValueMap
- func (c *StringValueMap) Contains(key string) bool
- func (c *StringValueMap) Get(key string) (any, bool)
- func (c *StringValueMap) GetAsArray(key string) *AnyValueArray
- func (c *StringValueMap) GetAsArrayWithDefault(key string, defaultValue *AnyValueArray) *AnyValueArray
- func (c *StringValueMap) GetAsBoolean(key string) bool
- func (c *StringValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool
- func (c *StringValueMap) GetAsDateTime(key string) time.Time
- func (c *StringValueMap) GetAsDateTimeWithDefault(key string, defaultValue time.Time) time.Time
- func (c *StringValueMap) GetAsDouble(key string) float64
- func (c *StringValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64
- func (c *StringValueMap) GetAsFloat(key string) float32
- func (c *StringValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32
- func (c *StringValueMap) GetAsInteger(key string) int
- func (c *StringValueMap) GetAsIntegerWithDefault(key string, defaultValue int) int
- func (c *StringValueMap) GetAsLong(key string) int64
- func (c *StringValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64
- func (c *StringValueMap) GetAsMap(key string) *AnyValueMap
- func (c *StringValueMap) GetAsMapWithDefault(key string, defaultValue *AnyValueMap) *AnyValueMap
- func (c *StringValueMap) GetAsNullableArray(key string) (*AnyValueArray, bool)
- func (c *StringValueMap) GetAsNullableBoolean(key string) (bool, bool)
- func (c *StringValueMap) GetAsNullableDateTime(key string) (time.Time, bool)
- func (c *StringValueMap) GetAsNullableDouble(key string) (float64, bool)
- func (c *StringValueMap) GetAsNullableFloat(key string) (float32, bool)
- func (c *StringValueMap) GetAsNullableInteger(key string) (int, bool)
- func (c *StringValueMap) GetAsNullableLong(key string) (int64, bool)
- func (c *StringValueMap) GetAsNullableMap(key string) (*AnyValueMap, bool)
- func (c *StringValueMap) GetAsNullableString(key string) (string, bool)
- func (c *StringValueMap) GetAsNullableUInteger(key string) (uint, bool)
- func (c *StringValueMap) GetAsNullableULong(key string) (uint64, bool)
- func (c *StringValueMap) GetAsObject(key string) (any, bool)
- func (c *StringValueMap) GetAsSingleObject() any
- func (c *StringValueMap) GetAsString(key string) string
- func (c *StringValueMap) GetAsStringWithDefault(key string, defaultValue string) string
- func (c *StringValueMap) GetAsUInteger(key string) uint
- func (c *StringValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint
- func (c *StringValueMap) GetAsULong(key string) uint64
- func (c *StringValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64
- func (c *StringValueMap) GetAsValue(key string) *AnyValue
- func (c *StringValueMap) InnerValue() any
- func (c *StringValueMap) Keys() []string
- func (c *StringValueMap) Len() int
- func (c *StringValueMap) MarshalJSON() ([]byte, error)
- func (c *StringValueMap) Put(key string, value any)
- func (c *StringValueMap) Remove(key string)
- func (c *StringValueMap) SetAsObject(key string, value any)
- func (c *StringValueMap) SetAsSingleObject(value any)
- func (c *StringValueMap) String() string
- func (c *StringValueMap) UnmarshalJSON(data []byte) error
- func (c *StringValueMap) Value() map[string]string
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
}
AnyValue 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 ¶
NewAnyValue 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
NewEmptyAnyValue creates a new empty instance of the object
Returns: new empty object
func (*AnyValue) Clone ¶
Clone creates a binary clone of this object.
Returns: a clone of this object.
func (*AnyValue) Equals ¶
Equals 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 ¶
EqualsAsType 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
GetAsArray 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 ¶
GetAsBoolean 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 ¶
GetAsBooleanWithDefault 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 ¶
GetAsDateTime 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 ¶
GetAsDateTimeWithDefault 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 ¶
GetAsDouble 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 ¶
GetAsDoubleWithDefault 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 ¶
GetAsDuration 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 ¶
GetAsDurationWithDefault 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 ¶
GetAsFloat 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 ¶
GetAsFloatWithDefault 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 ¶
GetAsInteger 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 ¶
GetAsIntegerWithDefault 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 ¶
GetAsLong 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 ¶
GetAsLongWithDefault 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
GetAsMap 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 ¶
GetAsNullableBoolean converts object value into a boolean or returns null if conversion is not possible.
Returns: boolean value and true or false and false if conversion is not supported.
func (*AnyValue) GetAsNullableDateTime ¶
GetAsNullableDateTime converts object value into a Date or returns null if conversion is not possible.
Returns: DateTime value and true or zero time and false if conversion is not supported.
func (*AnyValue) GetAsNullableDouble ¶
GetAsNullableDouble converts object value into a double or returns null if conversion is not possible.
Returns: double value and true or 0.0 and false if conversion is not supported.
func (*AnyValue) GetAsNullableDuration ¶
GetAsNullableDuration converts object value into a Duration or returns null if conversion is not possible.
Returns: Duration value and true or 0 and false if conversion is not supported.
func (*AnyValue) GetAsNullableFloat ¶
GetAsNullableFloat converts object value into a float or returns null if conversion is not possible.
Returns: float value and true or 0.0 and false if conversion is not supported.
func (*AnyValue) GetAsNullableInteger ¶
GetAsNullableInteger converts object value into an integer or returns null if conversion is not possible.
Returns: integer value and true or 0 and false if conversion is not supported.
func (*AnyValue) GetAsNullableLong ¶
GetAsNullableLong converts object value into a long or returns null if conversion is not possible.
Returns: long value and true or 0 and false if conversion is not supported.
func (*AnyValue) GetAsNullableString ¶
GetAsNullableString converts object value into a string or returns null if conversion is not possible.
Returns: string and true value or "" and false if conversion is not supported.
func (*AnyValue) GetAsNullableType ¶
GetAsNullableType 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 and true or null and false if conversion is not supported.
func (*AnyValue) GetAsNullableUInteger ¶
GetAsNullableUInteger converts object value into an unsigned 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) GetAsNullableULong ¶
GetAsNullableULong converts object value into an unsigned 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) GetAsObject ¶
GetAsObject gets the value stored in this object without any conversions.
Returns: the object value.
func (*AnyValue) GetAsString ¶
GetAsString 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 ¶
GetAsStringWithDefault 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 ¶
GetAsType 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 ¶
GetAsTypeWithDefault 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 ¶
GetAsUInteger 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 ¶
GetAsUIntegerWithDefault 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 ¶
GetAsULong converts object value into an unsigned long or returns 0 if conversion is not possible.
Returns: unsigned long value or 0 if conversion is not supported.
func (*AnyValue) GetAsULongWithDefault ¶
GetAsULongWithDefault converts object value into a unsiged long or returns default value if conversion is not possible.
Parameters: "defaultValue" - the default value Returns: unsigned long value or default if conversion is not supported.
func (*AnyValue) InnerValue ¶
InnerValue gets the value stored in this object without any conversions.
Returns: the object value.
func (*AnyValue) SetAsObject ¶
SetAsObject sets a new value for this object.
Parameters: "value" - the new object value.
func (*AnyValue) String ¶
String gets a string representation of the object.
Returns: a string representation of the object.
type AnyValueArray ¶
type AnyValueArray struct {
// contains filtered or unexported fields
}
AnyValueArray 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 convert.StringConverter see convert.TypeConverter see convert.BooleanConverter see convert.IntegerConverter see convert.LongConverter see convert.DoubleConverter see convert.FloatConverter see convert.DateTimeConverter see ICloneable
func NewAnyValueArray ¶
func NewAnyValueArray(values []any) *AnyValueArray
NewAnyValueArray creates a new instance of the array and assigns its value.
Parameters: values []any Returns: *AnyValueArray
func NewAnyValueArrayFromString ¶
func NewAnyValueArrayFromString(values string, separator string, removeDuplicates bool) *AnyValueArray
NewAnyValueArrayFromString 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 any) *AnyValueArray
NewAnyValueArrayFromValue converts specified value into AnyValueArray.
see convertor.ArrayConverter.ToArray Parameters: value any value to be converted Returns: *AnyValueArray a newly created AnyValueArray.
func NewAnyValueArrayFromValues ¶
func NewAnyValueArrayFromValues(values ...any) *AnyValueArray
NewAnyValueArrayFromValues creates a new AnyValueArray from a list of values
Parameters: values ...values any a list of values to initialize the created AnyValueArray Returns: *AnyValueArray a newly created AnyValueArray.
func NewEmptyAnyValueArray ¶
func NewEmptyAnyValueArray() *AnyValueArray
NewEmptyAnyValueArray creates a new instance of the empty array.
Returns *AnyValueArray
func (*AnyValueArray) Append ¶
func (c *AnyValueArray) Append(elements []any)
Append new elements to this array.
Parameters: elements []any a list of elements to be added.
func (*AnyValueArray) Clear ¶
func (c *AnyValueArray) Clear()
Clear this array by removing all its elements.
func (*AnyValueArray) Clone ¶
func (c *AnyValueArray) Clone() *AnyValueArray
Clone creates a binary clone of this object.
Returns: any a clone of this object.
func (*AnyValueArray) Contains ¶
func (c *AnyValueArray) Contains(value any) bool
Contains checks if this array contains a value. The check uses direct comparison between elements and the specified value.
Parameters: value any 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 any) bool
ContainsAsType checks if this array contains a value.
The check before comparison converts elements and the value to type specified by type code. see convert.TypeConverter.ToType see convert.TypeConverter.ToNullableType Parameters: - typeCode TypeCode a type code that defines a type to convert values before comparison - value any 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) (any, bool)
Get an array element specified by its index.
Parameters: index int an index of the element to get. Returns: value and true or nil and false if index is not valid
func (*AnyValueArray) GetAsArray ¶
func (c *AnyValueArray) GetAsArray(index int) *AnyValueArray
GetAsArray converts array element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
see NewAnyValueArrayFromValue Parameters: index int an index of element to get. Returns *AnyValueArray value of the element and true or empty AnyValueArray and false if conversion is not supported or index is ivalid.
func (*AnyValueArray) GetAsArrayWithDefault ¶
func (c *AnyValueArray) GetAsArrayWithDefault(index int, defaultValue *AnyValueArray) *AnyValueArray
GetAsArrayWithDefault 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 value of the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsBoolean ¶
func (c *AnyValueArray) GetAsBoolean(index int) bool
GetAsBoolean 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: boolean value ot the element or false if conversion is not supported.
func (*AnyValueArray) GetAsBooleanWithDefault ¶
func (c *AnyValueArray) GetAsBooleanWithDefault(index int, defaultValue bool) bool
GetAsBooleanWithDefault converts array element into a boolean or returns default value if conversion is not possible.
see convert.BooleanConverter.toBooleanWithDefault Parameters: index int an index of element to get. defaultValue: boolean the default value Returns: boolean value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsDateTime ¶
func (c *AnyValueArray) GetAsDateTime(index int) time.Time
GetAsDateTime 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 value ot the element or the current date if conversion is not supported.
func (*AnyValueArray) GetAsDateTimeWithDefault ¶
GetAsDateTimeWithDefault converts array element into a time.Time or returns default value if conversion is not possible.
see covert.DateTimeConverter.toDateTimeWithDefault Parameters: - index int an index of element to get. - defaultValue: time.Time the default value. Returns: time.time value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsDouble ¶
func (c *AnyValueArray) GetAsDouble(index int) float64
GetAsDouble 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: double value ot the element or 0 if conversion is not supported.
func (*AnyValueArray) GetAsDoubleWithDefault ¶
func (c *AnyValueArray) GetAsDoubleWithDefault(index int, defaultValue float64) float64
GetAsDoubleWithDefault converts array element into a double or returns default value if conversion is not possible.
see convert.DoubleConverter.ToDoubleWithDefault Parameters: - index int an index of element to get. - defaultValue: float64 the default value. Returns: double value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsDuration ¶
func (c *AnyValueArray) GetAsDuration(index int) time.Duration
GetAsDuration converts array element into a time.Duration or returns the current date if conversion is not possible.
see GetAsDurationWithDefault Parameters: index int an index of element to get. Returns: time.Duration 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
GetAsDurationWithDefault converts array element into a time.Duration or returns default value if conversion is not possible.
see convert.DateTimeConverter.toDateTimeWithDefault Parameters: - index int an index of element to get. - defaultValue: time.Duration the default value Returns: time.Duration value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsFloat ¶
func (c *AnyValueArray) GetAsFloat(index int) float32
GetAsFloat 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: float value ot the element or 0 if conversion is not supported.
func (*AnyValueArray) GetAsFloatWithDefault ¶
func (c *AnyValueArray) GetAsFloatWithDefault(index int, defaultValue float32) float32
GetAsFloatWithDefault converts array element into a float or returns default value if conversion is not possible.
see convert.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
GetAsInteger 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: integer value ot the element or 0 if conversion is not supported.
func (*AnyValueArray) GetAsIntegerWithDefault ¶
func (c *AnyValueArray) GetAsIntegerWithDefault(index int, defaultValue int) int
GetAsIntegerWithDefault converts array element into an integer or returns default value if conversion is not possible.
see convert.IntegerConverter.toIntegerWithDefault Parameters: index int an index of element to get. defaultValue int the default value Returns: integer value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsLong ¶
func (c *AnyValueArray) GetAsLong(index int) int64
GetAsLong 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 value ot the element or 0 if conversion is not supported.
func (*AnyValueArray) GetAsLongWithDefault ¶
func (c *AnyValueArray) GetAsLongWithDefault(index int, defaultValue int64) int64
GetAsLongWithDefault converts array element into a long or returns default value if conversion is not possible.
see convert.LongConverter.ToLongWithDefault Parameters: - index int an index of element to get. - defaultValue int64 the default value. Returns: int64 value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsMap ¶
func (c *AnyValueArray) GetAsMap(index int) *AnyValueMap
GetAsMap converts array element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
see AnyValueMap see NewAnyValueMapFromValue Parameters: index int an index of element to get. Returns: *AnyValueMap
func (*AnyValueArray) GetAsMapWithDefault ¶
func (c *AnyValueArray) GetAsMapWithDefault(index int, defaultValue *AnyValueMap) *AnyValueMap
GetAsMapWithDefault 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 value of the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsNullableArray ¶
func (c *AnyValueArray) GetAsNullableArray(index int) (*AnyValueArray, bool)
GetAsNullableArray converts array element into an AnyValueArray or returns nil if conversion is not possible.
see NewAnyValueArrayFromValue Parameters: index int an index of element to get. Returns: *AnyValueArray value of the element and true or nil and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableBoolean ¶
func (c *AnyValueArray) GetAsNullableBoolean(index int) (bool, bool)
GetAsNullableBoolean converts array element into a boolean or returns nil if conversion is not possible. see convert.BooleanConverter.toNullableBoolean
Parameters: index int an index of element to get. Returns: boolean value of the element and true or false and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableDateTime ¶
func (c *AnyValueArray) GetAsNullableDateTime(index int) (time.Time, bool)
GetAsNullableDateTime converts array element into a time.Time or returns nil if conversion is not possible.
see convert.DateTimeConverter.ToNullableDateTime Parameters: index int an index of element to get. Returns: time.Time value of the element and true or zero time and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableDouble ¶
func (c *AnyValueArray) GetAsNullableDouble(index int) (float64, bool)
GetAsNullableDouble converts array element into a double or returns nil if conversion is not possible.
see convert.DoubleConverter.toNullableDouble Parameters: index int an index of element to get. Returns: float64 value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableDuration ¶
func (c *AnyValueArray) GetAsNullableDuration(index int) (time.Duration, bool)
GetAsNullableDuration converts array element into a time.Duration or returns nil if conversion is not possible.
see convert.DateTimeConverter.toNullableDateTime Parameters: index int an index of element to get. Returns: time.Duration value of the element and true or 0 and false if conversion is not supported or index is ivalid.
func (*AnyValueArray) GetAsNullableFloat ¶
func (c *AnyValueArray) GetAsNullableFloat(index int) (float32, bool)
GetAsNullableFloat converts array element into a float or returns nil if conversion is not possible.
see convert.FloatConverter.ToNullableFloat Parameters: index int an index of element to get. Returns: float64 value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableInteger ¶
func (c *AnyValueArray) GetAsNullableInteger(index int) (int, bool)
GetAsNullableInteger converts array element into an integer or returns nil if conversion is not possible.
see convert.IntegerConverter.toNullableInteger Parameters: index int an index of element to get. Returns: integer value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableLong ¶
func (c *AnyValueArray) GetAsNullableLong(index int) (int64, bool)
GetAsNullableLong converts array element into a long or returns nil if conversion is not possible.
see convert.LongConverter.ToNullableLong Parameters: index int an index of element to get. Returns: int64 value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableMap ¶
func (c *AnyValueArray) GetAsNullableMap(index int) (*AnyValueMap, bool)
GetAsNullableMap converts array element into an AnyValueMap or returns nil if conversion is not possible.
see AnyValueMap see NewAnyValueMapFromValue Parameters: index int an index of element to get. Returns: *AnyValueMap value of the element and true or nil and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableString ¶
func (c *AnyValueArray) GetAsNullableString(index int) (string, bool)
GetAsNullableString converts array element into a string or returns nil if conversion is not possible.
see convert.StringConverter.ToNullableString Parameters: index int an index of element to get. Returns: string value of the element and true or "" and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableType ¶
GetAsNullableType converts array element into a value defined by specied typecode. If conversion is not possible it returns nil.
see convert.TypeConverter.ToNullableType Parameters - type: TypeCode the TypeCode that defined the type of the result - index int an index of element to get. Returns: any element value defined by the typecode and true or nil and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableUInteger ¶
func (c *AnyValueArray) GetAsNullableUInteger(index int) (uint, bool)
GetAsNullableUInteger converts array element into an unsigned integer or returns nil if conversion is not possible.
see convert.IntegerConverter.ToNullableUInteger Parameters: index int an index of element to get. Returns: unsigned integer value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsNullableULong ¶
func (c *AnyValueArray) GetAsNullableULong(index int) (uint64, bool)
GetAsNullableULong converts array element into a unsigned long or returns nil if conversion is not possible.
see convert.LongConverter.ToNullableULong Parameters: index int an index of element to get. Returns: uint64 value of the element and true or 0 and false if conversion is not supported or index is invalid.
func (*AnyValueArray) GetAsObject ¶
func (c *AnyValueArray) GetAsObject(index int) (any, bool)
GetAsObject 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: any the element value or value of the array when index is not defined.
func (*AnyValueArray) GetAsSingleObject ¶
func (c *AnyValueArray) GetAsSingleObject() any
GetAsSingleObject inflate AnyValueArray as single object
Returns: any
func (*AnyValueArray) GetAsString ¶
func (c *AnyValueArray) GetAsString(index int) string
GetAsString 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 value ot the element or "" if conversion is not supported.
func (*AnyValueArray) GetAsStringWithDefault ¶
func (c *AnyValueArray) GetAsStringWithDefault(index int, defaultValue string) string
GetAsStringWithDefault converts array element into a string or returns default value if conversion is not possible. see convert.StringConverter.ToStringWithDefault
Parameters: index int an index of element to get. defaultValue: string the default value Returns: 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) any
GetAsType 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: any element value defined by the typecode or default if conversion is not supported.
func (*AnyValueArray) GetAsTypeWithDefault ¶
GetAsTypeWithDefault converts array element into a value defined by specied typecode. If conversion is not possible it returns default value.
see convert.TypeConverter.ToTypeWithDefault Parameters: - type TypeCode the TypeCode that defined the type of the result - index int an index of element to get. - defaultValue any the default value Returns: any element value defined by the typecode or default value if conversion is not supported.
func (*AnyValueArray) GetAsUInteger ¶
func (c *AnyValueArray) GetAsUInteger(index int) uint
GetAsUInteger 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 ¶
func (c *AnyValueArray) GetAsUIntegerWithDefault(index int, defaultValue uint) uint
GetAsUIntegerWithDefault 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 ¶
func (c *AnyValueArray) GetAsULong(index int) uint64
GetAsULong 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 value ot the element or 0 if conversion is not supported.
func (*AnyValueArray) GetAsULongWithDefault ¶
func (c *AnyValueArray) GetAsULongWithDefault(index int, defaultValue uint64) uint64
GetAsULongWithDefault converts array element into a unsigned long or returns default value if conversion is not possible.
see convert.LongConverter.ToLongWithDefault Parameters: - index int an index of element to get. - defaultValue int64 the default value Returns: uint64 value ot the element or default value if conversion is not supported.
func (*AnyValueArray) GetAsValue ¶
func (c *AnyValueArray) GetAsValue(index int) (*AnyValue, bool)
GetAsValue 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 value of the element and true or empty AnyValue and false if conversion is not supported or index is invalid.
func (*AnyValueArray) InnerValue ¶
func (c *AnyValueArray) InnerValue() any
InnerValue return inner value of array as any
func (*AnyValueArray) IsValidIndex ¶
func (c *AnyValueArray) IsValidIndex(index int) bool
IsValidIndex checks that 0 <= index < len.
Parameters: index int an index of the element to get.
Returns: bool
func (*AnyValueArray) Push ¶
func (c *AnyValueArray) Push(value any)
Push element in the end of array
Parameters: value any an value what need to insert
func (*AnyValueArray) Put ¶
func (c *AnyValueArray) Put(index int, value any) bool
Put a new value into array element specified by its index.
Parameters: index int an index of the element to put. value any a new value for array element. Returns: true or false if index is invalid
func (*AnyValueArray) Remove ¶
func (c *AnyValueArray) Remove(index int) bool
Remove 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 any) bool
SetAsObject sets a new value to array element specified by its index. When the index is not defined, it resets the entire array value.
see convert.ArrayConverter.ToArray Parameters: index int an index of the element to set value any a new element or array value.
func (*AnyValueArray) SetAsSingleObject ¶
func (c *AnyValueArray) SetAsSingleObject(value any)
SetAsSingleObject sets AnyValueArray from input object
Parameters: value any input object
func (*AnyValueArray) String ¶
func (c *AnyValueArray) String() string
String converts array to string with coma separator
func (*AnyValueArray) Value ¶
func (c *AnyValueArray) Value() []any
Value returns array of elements []any
type AnyValueMap ¶
type AnyValueMap struct {
// contains filtered or unexported fields
}
AnyValueMap is a 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 := NewAnyValueMap(map[string]any{"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 convert.StringConverter see convert.TypeConverter see convert.BooleanConverter see convert.IntegerConverter see convert.LongConverter see convert.DoubleConverter see convert.FloatConverter see convert.DateTimeConverter see ICloneable
func InheritAnyValueMap ¶
func InheritAnyValueMap(base IMap) *AnyValueMap
InheritAnyValueMap 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]any) *AnyValueMap
NewAnyValueMap creates a new instance of the map and assigns its value. Parameters:
- values map[string]any
Returns *AnyValueMap
func NewAnyValueMapFromMaps ¶
func NewAnyValueMapFromMaps(maps ...map[string]any) *AnyValueMap
NewAnyValueMapFromMaps 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 ...any) *AnyValueMap
NewAnyValueMapFromTuples Creates a new AnyValueMap from a list of key-value pairs called tuples.
see NewAnyValueMapFromTuplesArray Parameters: tuples ...tuples: any 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 []any) *AnyValueMap
NewAnyValueMapFromTuplesArray creates a new AnyValueMap 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: []any a list of values where odd elements are keys and the following even elements are values Returns: *AnyValueMap a newly created AnyValueArray.
func NewAnyValueMapFromValue ¶
func NewAnyValueMapFromValue(value any) *AnyValueMap
NewAnyValueMapFromValue Converts specified value into AnyValueMap.
see SetAsSingleObject Parameters: value any value to be converted Returns: *AnyValueMap a newly created AnyValueMap.
func NewEmptyAnyValueMap ¶
func NewEmptyAnyValueMap() *AnyValueMap
NewEmptyAnyValueMap creates a new empty instance of the map.
Returns: *AnyValueMap
func (*AnyValueMap) Append ¶
func (c *AnyValueMap) Append(value map[string]any)
Append new elements to this map.
Parameters: value: map[string]any a map of elements to be added.
func (*AnyValueMap) Clear ¶
func (c *AnyValueMap) Clear()
Clear this map by removing all its elements.
func (*AnyValueMap) Clone ¶
func (c *AnyValueMap) Clone() *AnyValueMap
Clone creates a binary clone of this object.
Returns: any a clone of this object.
func (*AnyValueMap) Contains ¶
func (c *AnyValueMap) Contains(key string) bool
Contains 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) (any, bool)
Get a map element specified by its key.
Parameters: key string a key of the element to get. Returns: any the value of the map element.
func (*AnyValueMap) GetAsArray ¶
func (c *AnyValueMap) GetAsArray(key string) *AnyValueArray
GetAsArray converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
see AnyValueArray see NewAnyValueArrayFromValue Parameters: key string a key of element to get. Returns: *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
GetAsArrayWithDefault 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 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsBoolean ¶
func (c *AnyValueMap) GetAsBoolean(key string) bool
GetAsBoolean 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 value of the element or false if conversion is not supported.
func (*AnyValueMap) GetAsBooleanWithDefault ¶
func (c *AnyValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool
GetAsBooleanWithDefault converts map element into a boolean or returns default value if conversion is not possible.
see convert.BooleanConverter.toBooleanWithDefault Parameters: - key string a key of element to get. - defaultValue bool the default value Returns: bool value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsDateTime ¶
func (c *AnyValueMap) GetAsDateTime(key string) time.Time
GetAsDateTime 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 value of the element or the current date if conversion is not supported.
func (*AnyValueMap) GetAsDateTimeWithDefault ¶
GetAsDateTimeWithDefault converts map element into a time.Time or returns default value if conversion is not possible.
see convert.DateTimeConverter.toDateTimeWithDefault Parameters: - key: string a key of element to get. - defaultValue: Date the default value Returns: time.Time value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsDouble ¶
func (c *AnyValueMap) GetAsDouble(key string) float64
GetAsDouble 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 value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsDoubleWithDefault ¶
func (c *AnyValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64
GetAsDoubleWithDefault converts map element into a double or returns default value if conversion is not possible. see convert.DoubleConverter.ToDoubleWithDefault
Parameters: - key string a key of element to get. - defaultValue float64 the default value Returns: float64 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsDuration ¶
func (c *AnyValueMap) GetAsDuration(key string) time.Duration
GetAsDuration converts map element into a time.Duration or returns the current date if conversion is not possible.
see GetAsDurationWithDefault Parameters: key string a key of element to get. Returns: 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
GetAsDurationWithDefault converts map element into a time.Duration or returns default value if conversion is not possible.
see convert.DurationConverter.toDateTimeWithDefault Parameters: - key: string a key of element to get. - defaultValue: Date the default value Returns: time.Duration value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsFloat ¶
func (c *AnyValueMap) GetAsFloat(key string) float32
GetAsFloat 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 value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsFloatWithDefault ¶
func (c *AnyValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32
GetAsFloatWithDefault converts map element into a flot or returns default value if conversion is not possible.
see convert.FloatConverter.toFloatWithDefault Parameters: - key string a key of element to get. - defaultValue float32 the default value Returns: float32 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsInteger ¶
func (c *AnyValueMap) GetAsInteger(key string) int
GetAsInteger 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: integer value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsIntegerWithDefault ¶
func (c *AnyValueMap) GetAsIntegerWithDefault(key string, defaultValue int) int
GetAsIntegerWithDefault converts map element into an integer or returns default value if conversion is not possible.
see convert.IntegerConverter.toIntegerWithDefault Parameters: - key string a key of element to get. -defaultValue int the default value Returns: integer value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsLong ¶
func (c *AnyValueMap) GetAsLong(key string) int64
GetAsLong 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 value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsLongWithDefault ¶
func (c *AnyValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64
GetAsLongWithDefault converts map element into a long or returns default value if conversion is not possible.
see convert.LongConverter.toLongWithDefault Parameters: -key string a key of element to get. - defaultValue int64 the default value Returns: int64 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsMap ¶
func (c *AnyValueMap) GetAsMap(key string) *AnyValueMap
GetAsMap converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
see NewAnyValueMapFromValue Parameters: key string a key of element to get. Returns: *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
GetAsMapWithDefault 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 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsNullableArray ¶
func (c *AnyValueMap) GetAsNullableArray(key string) (*AnyValueArray, bool)
GetAsNullableArray converts map element into an AnyValueArray or returns null if conversion is not possible.
see AnyValueArray see NewAnyValueArrayFromValue Parameters: key string a key of element to get. Returns: *AnyValueArray value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableBoolean ¶
func (c *AnyValueMap) GetAsNullableBoolean(key string) (bool, bool)
GetAsNullableBoolean converts map element into a boolean or returns null if conversion is not possible. see convert.BooleanConverter.toNullableBoolean
Parameters: key string a key of element to get. Returns: bool value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableDateTime ¶
func (c *AnyValueMap) GetAsNullableDateTime(key string) (time.Time, bool)
GetAsNullableDateTime converts map element into a time.Time or returns null if conversion is not possible.
see convert.DateTimeConverter.ToNullableDateTime Parameters: key string a key of element to get. Returns: time.Time value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableDouble ¶
func (c *AnyValueMap) GetAsNullableDouble(key string) (float64, bool)
GetAsNullableDouble converts map element into a double or returns null if conversion is not possible.
see convert.DoubleConverter.toNullableDouble Parameters: key string a key of element to get. Returns: float64 value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableDuration ¶
func (c *AnyValueMap) GetAsNullableDuration(key string) (time.Duration, bool)
GetAsNullableDuration converts map element into a time.Duration or returns null if conversion is not possible.
see convert.DurationConverter.toNullableDateTime Parameters: key string a key of element to get. Returns: time.Duration value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableFloat ¶
func (c *AnyValueMap) GetAsNullableFloat(key string) (float32, bool)
GetAsNullableFloat converts map element into a float or returns null if conversion is not possible.
see convert.FloatConverter.toNullableFloat Parameters: key string a key of element to get. Returns: float32 value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableInteger ¶
func (c *AnyValueMap) GetAsNullableInteger(key string) (int, bool)
GetAsNullableInteger converts map element into an integer or returns null if conversion is not possible.
see convert.IntegerConverter.toNullableInteger Parameters: key string a key of element to get. Returns: value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableLong ¶
func (c *AnyValueMap) GetAsNullableLong(key string) (int64, bool)
GetAsNullableLong converts map element into a long or returns null if conversion is not possible.
see convert.LongConverter.toNullableLong Parameters: key string a key of element to get. Returns: int64 value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableMap ¶
func (c *AnyValueMap) GetAsNullableMap(key string) (*AnyValueMap, bool)
GetAsNullableMap converts map element into an AnyValueMap or returns null if conversion is not possible.
see NewAnyValueMapFromValue Parameters: key string a key of element to get. Returns: *AnyValueMap value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableString ¶
func (c *AnyValueMap) GetAsNullableString(key string) (string, bool)
GetAsNullableString converts map element into a string or returns null if conversion is not possible. see convert.StringConverter.ToNullableString
Parameters: key string a key of element to get. Returns: string value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableType ¶
GetAsNullableType 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: any element value defined by the typecode or null if conversion is not supported.
func (*AnyValueMap) GetAsNullableUInteger ¶
func (c *AnyValueMap) GetAsNullableUInteger(key string) (uint, bool)
GetAsNullableUInteger converts map element into an unsigned integer or returns false if conversion is not possible.
see convert.IntegerConverter.toNullableUInteger Parameters: key string a key of element to get. Returns: value of the element or false if conversion is not supported.
func (*AnyValueMap) GetAsNullableULong ¶
func (c *AnyValueMap) GetAsNullableULong(key string) (uint64, bool)
GetAsNullableULong converts map element into a long or returns null if conversion is not possible.
see convert.LongConverter.toNullableLong Parameters: key string a key of element to get. Returns: int64 value of the element or null if conversion is not supported.
func (*AnyValueMap) GetAsObject ¶
func (c *AnyValueMap) GetAsObject(key string) (any, bool)
GetAsObject 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: any the element value or value of the map when index is not defined.
func (*AnyValueMap) GetAsSingleObject ¶
func (c *AnyValueMap) GetAsSingleObject() any
GetAsSingleObject gets the value stored in map element without any conversions. When element index is not defined it returns the entire array value.
Returns: any the element value or value of the array when index is not defined.
func (*AnyValueMap) GetAsString ¶
func (c *AnyValueMap) GetAsString(key string) string
GetAsString 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 value of the element or "" if conversion is not supported.
func (*AnyValueMap) GetAsStringWithDefault ¶
func (c *AnyValueMap) GetAsStringWithDefault(key string, defaultValue string) string
GetAsStringWithDefault converts map element into a string or returns default value if conversion is not possible. see convert.StringConverter.ToStringWithDefault
Parameters: - key string a key of element to get. - defaultValue string the default value Returns: 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) any
GetAsType 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: any element value defined by the typecode or default if conversion is not supported.
func (*AnyValueMap) GetAsTypeWithDefault ¶
GetAsTypeWithDefault converts map element into a value defined by specied typecode. If conversion is not possible it returns default value.
see convert.TypeConverter.toTypeWithDefault Parameters: - type TypeCode the TypeCode that defined the type of the result - key string a key of element to get. - defaultValue any the default value Returns: any element value defined by the typecode or default value if conversion is not supported.
func (*AnyValueMap) GetAsUInteger ¶
func (c *AnyValueMap) GetAsUInteger(key string) uint
GetAsUInteger 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: unsigned integer value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsUIntegerWithDefault ¶
func (c *AnyValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint
GetAsUIntegerWithDefault converts map element into an unsigned integer or returns default value if conversion is not possible.
see IntegerConverter.ToUIntegerWithDefault Parameters: - key string a key of element to get. -defaultValue int the default value Returns: unsigned integer value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsULong ¶
func (c *AnyValueMap) GetAsULong(key string) uint64
GetAsULong 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 value of the element or 0 if conversion is not supported.
func (*AnyValueMap) GetAsULongWithDefault ¶
func (c *AnyValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64
GetAsULongWithDefault converts map element into a unsigned long or returns default value if conversion is not possible.
see convert.LongConverter.ToLongWithDefault
Parameters:
- key string a key of element to get.
- defaultValue int64 the default value Returns: uint64 value of the element or default value if conversion is not supported.
func (*AnyValueMap) GetAsValue ¶
func (c *AnyValueMap) GetAsValue(key string) *AnyValue
GetAsValue converts map element into an AnyValue or returns an empty AnyValue if conversion is not possible.
see AnyValue see NewAnyValue Parameters: key string a key of element to get. Returns: *AnyValue value of the element or empty AnyValue if conversion is not supported.
func (*AnyValueMap) InnerValue ¶
func (c *AnyValueMap) InnerValue() any
InnerValue return inner values of map as any
func (*AnyValueMap) Keys ¶
func (c *AnyValueMap) Keys() []string
Keys 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
Len 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 any)
Put a new value into map element specified by its key.
Parameters: - key string a key of the element to put. - value any a new value for map element. Returns: any
func (*AnyValueMap) Remove ¶
func (c *AnyValueMap) Remove(key string)
Remove 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 any)
SetAsObject sets a new value to map element specified by its index. When the index is not defined, it resets the entire map value.
see convert.MapConverter.ToMap Parameters: - key string a key of the element to set - value any a new element or map value.
func (*AnyValueMap) SetAsSingleObject ¶
func (c *AnyValueMap) SetAsSingleObject(value any)
SetAsSingleObject sets a new value to map. see convert.MapConverter.ToMap
Parameters: value any a new element or array value.
func (*AnyValueMap) String ¶
func (c *AnyValueMap) String() 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]any
Value returns map of elements as map[string]any
type ICloneable ¶
type ICloneable[T any] interface { // Clone creates a binary clone of this object. // returns: a clone of this object. Clone() T }
ICloneable Interface for data objects that are able to create their full binary copy.
Example type MyStruct struct { ... } func (c *MyStruct) Clone() *MyStruct { cloneObj := new(MyStruct) // Copy every attribute from this to cloneObj here. ... return cloneObj }
type IEquatable ¶
type StringValueMap ¶
type StringValueMap struct {
// contains filtered or unexported fields
}
StringValueMap Cross-language implementation of a map (dictionary) where all keys and values are strings. The stored values can be converted to different types using variety of accessor methods. The string map is highly versatile. It can be converted into many formats, stored and sent over the wire.
This class is widely used in Pip.Services as a basis for variety of classes, such as ConfigParams, ConnectionParams, CredentialParams and others.
Example: value1 := NewStringValueMapFromString("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
func NewEmptyStringValueMap ¶
func NewEmptyStringValueMap() *StringValueMap
NewEmptyStringValueMap creates a new instance of the map.
func NewStringValueMap ¶
func NewStringValueMap(value map[string]string) *StringValueMap
NewStringValueMap 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
NewStringValueMapFromMaps 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
NewStringValueMapFromString 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 ...any) *StringValueMap
NewStringValueMapFromTuples creates a new StringValueMap from a list of key-value pairs called tuples.
see NewStringValueMapFromTuplesArray Parameters: tuples ...any a list of values where odd elements are keys and the following even elements are values Returns: *StringValueMap a newly created StringValueMap.
func NewStringValueMapFromTuplesArray ¶
func NewStringValueMapFromTuplesArray(tuples []any) *StringValueMap
NewStringValueMapFromTuplesArray 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: []any 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 any) *StringValueMap
NewStringValueMapFromValue converts specified value into StringValueMap.
see SetAsSingleObject Parameters: value any value to be converted Returns: *StringValueMap a newly created StringValueMap.
func (*StringValueMap) Append ¶
func (c *StringValueMap) Append(values map[string]string)
Append 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]any)
AppendAny new elements to this map.
Parameters: values map[string]any a map with elements to be added.
func (*StringValueMap) Clear ¶
func (c *StringValueMap) Clear()
Clear this map by removing all its elements.
func (*StringValueMap) Clone ¶
func (c *StringValueMap) Clone() *StringValueMap
Clone creates a binary clone of this object.
Returns any a clone of this object.
func (*StringValueMap) Contains ¶
func (c *StringValueMap) Contains(key string) bool
Contains 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) (any, bool)
Get 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
GetAsArray converts map element into an AnyValueArray or returns empty AnyValueArray if conversion is not possible.
see AnyValueArray see NewAnyValueArrayFromValue Parameters: key string a key of element to get. Returns: *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
GetAsArrayWithDefault 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 value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsBoolean ¶
func (c *StringValueMap) GetAsBoolean(key string) bool
GetAsBoolean 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: boolean value of the element or false if conversion is not supported.
func (*StringValueMap) GetAsBooleanWithDefault ¶
func (c *StringValueMap) GetAsBooleanWithDefault(key string, defaultValue bool) bool
GetAsBooleanWithDefault 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
GetAsDateTime 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 value of the element or the current date if conversion is not supported.
func (*StringValueMap) GetAsDateTimeWithDefault ¶
GetAsDateTimeWithDefault converts map element into a time.Time or returns default value if conversion is not possible.
see convert.DateTimeConverter.toDateTimeWithDefault Parameters: - key string a key of element to get. - defaultValue time.Time the default value Returns: time.Time value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsDouble ¶
func (c *StringValueMap) GetAsDouble(key string) float64
GetAsDouble 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: value of the element or 0 if conversion is not supported.
func (*StringValueMap) GetAsDoubleWithDefault ¶
func (c *StringValueMap) GetAsDoubleWithDefault(key string, defaultValue float64) float64
GetAsDoubleWithDefault converts map element into a float64 or returns default value if conversion is not possible.
see convert.DoubleConverter.toDoubleWithDefault Parameters: - key string a key of element to get. - defaultValue float64 the default value Returns: float64 value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsFloat ¶
func (c *StringValueMap) GetAsFloat(key string) float32
GetAsFloat 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 value of the element or 0 if conversion is not supported.
func (*StringValueMap) GetAsFloatWithDefault ¶
func (c *StringValueMap) GetAsFloatWithDefault(key string, defaultValue float32) float32
GetAsFloatWithDefault converts map element into a float32 or returns default value if conversion is not possible.
see convert.FloatConverter.toFloatWithDefault Parameters: - key string a key of element to get. - defaultValue: float32 the default value Returns: float32 value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsInteger ¶
func (c *StringValueMap) GetAsInteger(key string) int
GetAsInteger 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
GetAsIntegerWithDefault converts map element into an integer or returns default value if conversion is not possible.
see convert.IntegerConverter.toIntegerWithDefault Parameters: - key string a key of element to get. - defaultValue int the default value Returns: integer value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsLong ¶
func (c *StringValueMap) GetAsLong(key string) int64
GetAsLong converts map element into a int64 or returns 0 if conversion is not possible.
see GetAsLongWithDefault Parameters: key string a key of element to get. Returns: int64 value of the element or 0 if conversion is not supported.
func (*StringValueMap) GetAsLongWithDefault ¶
func (c *StringValueMap) GetAsLongWithDefault(key string, defaultValue int64) int64
GetAsLongWithDefault converts map element into a int64 or returns default value if conversion is not possible.
see convert.LongConverter.toLongWithDefault Parameters: - key string a key of element to get. - defaultValue int64 the default value Returns: value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsMap ¶
func (c *StringValueMap) GetAsMap(key string) *AnyValueMap
GetAsMap converts map element into an AnyValueMap or returns empty AnyValueMap if conversion is not possible.
see NewAnyValueMapFromValue Parameters: key string a key of element to get. Returns: *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
GetAsMapWithDefault 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 value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsNullableArray ¶
func (c *StringValueMap) GetAsNullableArray(key string) (*AnyValueArray, bool)
GetAsNullableArray converts map element into an AnyValueArray or returns null if conversion is not possible.
see AnyValueArray see NewAnyValueArrayFromValue Parameters: key string a key of element to get. Returns: *AnyValueArray value of the element or nil if conversion is not supported.
func (*StringValueMap) GetAsNullableBoolean ¶
func (c *StringValueMap) GetAsNullableBoolean(key string) (bool, bool)
GetAsNullableBoolean converts map element into a boolean or returns null if conversion is not possible.
see convert.BooleanConverter.toNullableBoolean Parameters: key string a key of element to get. Returns: boolean value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableDateTime ¶
func (c *StringValueMap) GetAsNullableDateTime(key string) (time.Time, bool)
GetAsNullableDateTime converts map element into a time.Time or returns null if conversion is not possible.
see convert.DateTimeConverter.toNullableDateTime Parameters: key string a key of element to get. Returns: time.Time value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableDouble ¶
func (c *StringValueMap) GetAsNullableDouble(key string) (float64, bool)
GetAsNullableDouble converts map element into a float64 or returns null if conversion is not possible.
see convert.DoubleConverter.toNullableDouble Parameters: key string a key of element to get. Returns: float64 value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableFloat ¶
func (c *StringValueMap) GetAsNullableFloat(key string) (float32, bool)
GetAsNullableFloat converts map element into a float32 or returns null if conversion is not possible.
see convert.FloatConverter.toNullableFloat Parameters: key string a key of element to get. Returns: float32 value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableInteger ¶
func (c *StringValueMap) GetAsNullableInteger(key string) (int, bool)
GetAsNullableInteger converts map element into an integer or returns null if conversion is not possible.
see convert.IntegerConverter.toNullableInteger Parameters: key string a key of element to get. Returns: integer value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableLong ¶
func (c *StringValueMap) GetAsNullableLong(key string) (int64, bool)
GetAsNullableLong converts map element into a int64 or returns null if conversion is not possible.
see convert.LongConverter.toNullableLong Parameters: key string a key of element to get. Returns: int64 value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableMap ¶
func (c *StringValueMap) GetAsNullableMap(key string) (*AnyValueMap, bool)
GetAsNullableMap converts map element into an AnyValueMap or returns null if conversion is not possible.
see NewAnyValueMapFromValue Parameters: key string a key of element to get. Returns: *AnyValueMap value of the element or nil if conversion is not supported.
func (*StringValueMap) GetAsNullableString ¶
func (c *StringValueMap) GetAsNullableString(key string) (string, bool)
GetAsNullableString 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 value of the element or null if conversion is not supported.
func (*StringValueMap) GetAsNullableUInteger ¶
func (c *StringValueMap) GetAsNullableUInteger(key string) (uint, bool)
GetAsNullableUInteger 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: unsigned integer value of the element or o and false if conversion is not supported.
func (*StringValueMap) GetAsNullableULong ¶
func (c *StringValueMap) GetAsNullableULong(key string) (uint64, bool)
GetAsNullableULong converts map element into a uint64 or returns null if conversion is not possible. see convert.LongConverter.ToNullableLong
Parameters: key string a key of element to get. Returns: int64 value of the element or false if conversion is not supported.
func (*StringValueMap) GetAsObject ¶
func (c *StringValueMap) GetAsObject(key string) (any, bool)
GetAsObject 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: any the element value or value of the map when index is not defined.
func (*StringValueMap) GetAsSingleObject ¶
func (c *StringValueMap) GetAsSingleObject() any
GetAsSingleObject Gets the value stored in map element without any conversions. When element index is not defined it returns the entire array value.
Returns: any the element value or value of the array when index is not defined.
func (*StringValueMap) GetAsString ¶
func (c *StringValueMap) GetAsString(key string) string
GetAsString 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 value of the element or "" if conversion is not supported.
func (*StringValueMap) GetAsStringWithDefault ¶
func (c *StringValueMap) GetAsStringWithDefault(key string, defaultValue string) string
GetAsStringWithDefault converts map element into a string or returns default value if conversion is not possible.
see convert.StringConverter.toStringWithDefault Parameters: - key string a key of element to get. - defaultValue string the default value Returns: string value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsUInteger ¶
func (c *StringValueMap) GetAsUInteger(key string) uint
GetAsUInteger 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 uint
func (*StringValueMap) GetAsUIntegerWithDefault ¶
func (c *StringValueMap) GetAsUIntegerWithDefault(key string, defaultValue uint) uint
GetAsUIntegerWithDefault 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 uint the default value Returns uint integer value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsULong ¶
func (c *StringValueMap) GetAsULong(key string) uint64
GetAsULong converts map element into a uint64 or returns 0 if conversion is not possible.
see GetAsULongWithDefault Parameters: key string a key of element to get. Returns: uint64 value of the element or 0 if conversion is not supported.
func (*StringValueMap) GetAsULongWithDefault ¶
func (c *StringValueMap) GetAsULongWithDefault(key string, defaultValue uint64) uint64
GetAsULongWithDefault converts map element into a uint64 or returns default value if conversion is not possible.
see convert.LongConverter.ToULongWithDefault Parameters: - key string a key of element to get. - defaultValue uint64 the default value Returns: uint64 value of the element or default value if conversion is not supported.
func (*StringValueMap) GetAsValue ¶
func (c *StringValueMap) GetAsValue(key string) *AnyValue
GetAsValue 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 value of the element or empty AnyValue if conversion is not supported.
func (*StringValueMap) InnerValue ¶
func (c *StringValueMap) InnerValue() any
InnerValue return inner values of map as any
func (*StringValueMap) Keys ¶
func (c *StringValueMap) Keys() []string
Keys 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
Len 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 any)
Put a new value into map element specified by its key.
Parameters: - key string a key of the element to put. - value any a new value for map element.
func (*StringValueMap) Remove ¶
func (c *StringValueMap) Remove(key string)
Remove 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 any)
SetAsObject sets a new value to map element specified by its index. When the index is not defined, it resets the entire map value.
Parameters: - key any a key of the element to set - value any a new element or map value.
func (*StringValueMap) SetAsSingleObject ¶
func (c *StringValueMap) SetAsSingleObject(value any)
SetAsSingleObject sets a new value to map.
Parameters: value any a new element or array value.
func (*StringValueMap) String ¶
func (c *StringValueMap) String() 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: 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
Value returns map of elements as map[string]any