Documentation ¶
Overview ¶
Package keyvalue provide an ability to working with Key-Value pair in golang `map[string]interface{} types`
Index ¶
- func IsAbleToConvert(p interface{}) bool
- type KeyValue
- func (k KeyValue) Assign(source KeyValue, replaceExist ...bool)
- func (k KeyValue) AssignTo(target KeyValue, replaceExist ...bool)
- func (k KeyValue) JSON() map[string]string
- func (k KeyValue) Keys() []string
- func (k KeyValue) String() string
- func (k KeyValue) ToMap() map[string]interface{}
- func (k KeyValue) Unmarshal(i interface{}) error
- func (k KeyValue) Values() []interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsAbleToConvert ¶
func IsAbleToConvert(p interface{}) bool
IsAbleToConvert check whether an interface could be able to cast to KeyValue
Types ¶
type KeyValue ¶
type KeyValue map[string]interface{}
func FromStruct ¶
FromStruct create a KeyValue from Struct
func (KeyValue) Assign ¶
Assign will assign Value by other KeyValue. This method inspired by JavaScript `Object.assign()` method Reference: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign
func (KeyValue) AssignTo ¶
AssignTo will assign Value from a KeyValue to other KeyValue with corresponding `Key`. This method is an opposite of Assign and return value by `in-place` operation.
func (KeyValue) String ¶
String method will format the KeyValue in JSON format when calling such methods `string(KeyValue)` or fmt.Println(KeyValue)`