Documentation ¶
Index ¶
- type Lexicon
- func (pointer *Lexicon) Add(key string, value interface{}) *Lexicon
- func (pointer *Lexicon) Concatenate(lexicon *Lexicon) *Lexicon
- func (pointer *Lexicon) Each(f func(key string, value interface{})) *Lexicon
- func (pointer *Lexicon) Fetch(key string) interface{}
- func (pointer *Lexicon) Get(key string) (interface{}, bool)
- func (pointer *Lexicon) Has(key string) bool
- func (pointer *Lexicon) Keys() *slice.Slice
- func (pointer *Lexicon) Len() int
- func (pointer *Lexicon) Map(f func(key string, value interface{}) interface{}) *Lexicon
- func (pointer *Lexicon) Missing(key string) bool
- func (pointer *Lexicon) Remove(key string) bool
- func (pointer *Lexicon) Replace(key string, value interface{}) bool
- func (pointer *Lexicon) Values() *slice.Slice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Lexicon ¶
type Lexicon map[string]interface{}
Lexicon is a map-like object whose methods are used to perform traversal and mutation operations by key-value pair.
func New ¶
func New() *Lexicon
New instantiates a new empty Lexicon pointer. Lexicon pointers are mutable and hold and arguments as an interface. Unlike basic map-like objects, the Lexicon provides safe getters and setters, aiming to reduce the likelyhood of an exception being thrown during an operation.
func (*Lexicon) Add ¶
Add method adds one element to the Lexicon using the key reference and returns the modified Lexicon.
func (*Lexicon) Concatenate ¶
Concatenate merges two Lexicons.
func (*Lexicon) Fetch ¶
Fetch retrieves the interface held by the argument key. Returns nil if key does not exist.
func (*Lexicon) Get ¶
Get returns the interface held by the argument key and a boolean indicating if it was successfully retrieved.
func (*Lexicon) Keys ¶
Keys method returns a Slice of a given Lexicon's own property names, in the same order as we get with a normal loop.
func (*Lexicon) Map ¶
Map method executes a provided function once for each Lexicon element and sets the returned value to the current key.
func (*Lexicon) Remove ¶
Remove method removes a entry from the Lexicon if it exists. Returns a boolean to confirm if it succeeded.