Documentation
¶
Index ¶
- type Collection
- func (s *Collection) PadWithMap(size int)
- func (s *Collection) Push(value interface{})
- func (s *Collection) Range(handler func(item interface{}, index int) (bool, error)) error
- func (s *Collection) RangeInt(handler func(item interface{}, index int) (bool, error)) error
- func (s *Collection) RangeMap(handler func(item Map, index int) (bool, error)) error
- func (s *Collection) RangeString(handler func(item interface{}, index int) (bool, error)) error
- func (s *Collection) String() string
- type Map
- func (s *Map) Apply(source map[string]interface{})
- func (s *Map) AsEncodableMap() map[string]interface{}
- func (s *Map) Clone() Map
- func (s *Map) Delete(keys ...string)
- func (s *Map) Expand(source interface{}) interface{}
- func (s *Map) ExpandAsText(text string) string
- func (s *Map) Get(key string) interface{}
- func (s *Map) GetBoolean(key string) bool
- func (s *Map) GetCollection(key string) *Collection
- func (s *Map) GetFloat(key string) float64
- func (s *Map) GetInt(key string) int
- func (s *Map) GetMap(key string) Map
- func (s *Map) GetString(key string) string
- func (s *Map) GetValue(expr string) (interface{}, bool)
- func (s *Map) Has(key string) bool
- func (s *Map) Put(key string, value interface{})
- func (s *Map) Range(callback func(k string, v interface{}) (bool, error)) error
- func (s *Map) SetValue(expr string, value interface{})
- type Udf
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶
type Collection []interface{}
Collection represents a slice of interface{} (generic type)
func NewCollection ¶
func NewCollection() *Collection
NewCollection creates a new collection and returns a pointer
func (*Collection) PadWithMap ¶
func (s *Collection) PadWithMap(size int)
PadWithMap creates missing elements with a map
func (*Collection) Push ¶
func (s *Collection) Push(value interface{})
Push appends provided value to the slice
func (*Collection) Range ¶
func (s *Collection) Range(handler func(item interface{}, index int) (bool, error)) error
Range iterates over every item in this collection as long as handler returns true. Handler takes an index and index of the slice element.
func (*Collection) RangeInt ¶
func (s *Collection) RangeInt(handler func(item interface{}, index int) (bool, error)) error
RangeMap iterates every int item in this collection as long as handler returns true. Handler takes an index and index of the slice element
func (*Collection) RangeMap ¶
RangeMap iterates every map item in this collection as long as handler returns true. Handler takes an index and index of the slice element
func (*Collection) RangeString ¶
func (s *Collection) RangeString(handler func(item interface{}, index int) (bool, error)) error
RangeMap iterates every string item in this collection as long as handler returns true. Handler takes an index and index of the slice element
func (*Collection) String ¶
func (s *Collection) String() string
String returns a string representation of this collection
type Map ¶
type Map map[string]interface{}
Map types is an alias type to map[string]interface{} with extended behaviours
func (*Map) AsEncodableMap ¶
Returns a map that can be encoded by json or other decoders. Since a map can store a function, it filters out any non marshalable types.
func (*Map) Expand ¶
func (s *Map) Expand(source interface{}) interface{}
Expand expands provided value of any type with dollar sign expression/
func (*Map) ExpandAsText ¶
ExpandAsText expands all matching expressions starting with dollar sign ($)
func (*Map) GetBoolean ¶
GetBoolean returns value for provided key as boolean.
func (*Map) GetCollection ¶
func (s *Map) GetCollection(key string) *Collection
GetCollection returns value for provided key as collection pointer.
func (*Map) GetValue ¶
GetValue returns value for provided expression. The expression uses dot (.) to denote nested data structure. The following expression as supported
- <-key shift
- ++key pre increment
- key++ post increment
- $key reference access
func (*Map) Range ¶
Range iterates every key, value pair of this map, calling supplied callback as long it does return true.
func (*Map) SetValue ¶
Set value sets value in the map for the supplied expression. The expression uses dot (.) to denote nested data structure. For instance the following expression key1.subKey1.attr1 Would take or create map for key1, followied bu takeing or creating antother map for subKey1 to set attr1 key with provided value The following expression as supported
- $key reference - the final key is determined from key's content.
- ->key push expression to append value at the end of the slice