Float32Slice is a typedef to allow sortable float32 slices
IsSorted is a shortcut for sort.IsSorted(s)
( T) Len() int( T) Less(i, j int) bool
Set sets all values in this slice to the given value
Sort is a shortcut for sort.Sort(s)
( T) Swap(i, j int)
T : sort.Interface
Int64Slice is a typedef to allow sortable int64 slices
IsSorted is a shortcut for sort.IsSorted(s)
( T) Len() int( T) Less(i, j int) bool
Set sets all values in this slice to the given value
Sort is a shortcut for sort.Sort(s)
( T) Swap(i, j int)
T : sort.Interface
MarshalMap is a wrapper type to attach converter methods to maps normally
returned by marshalling methods, i.e. key/value parsers.
All methods that do a conversion will return an error if the value stored
behind key is not of the expected type or if the key is not existing in the
map.
Array returns a value at key that is expected to be a []interface{}
Bool returns a value at key that is expected to be a boolean
Bytes returns a value at key that is expected to be a []byte
Clone creates a copy of the given MarshalMap.
Delete a value from a given path.
The path must point to a map key. Deleting from arrays is not supported.
Duration returns a value at key that is expected to be a string
Float returns a value at key that is expected to be a float64 or compatible
float value.
Int returns a value at key that is expected to be an int64 or compatible
integer value.
Int64Array returns a value at key that is expected to be a []int64
This function supports conversion (by copy) from
* []interface{}
Int64Slice is an alias for Int64Array
Map returns a value at key that is expected to be a
map[interface{}]interface{}.
MarshalMap returns a value at key that is expected to be another MarshalMap
This function supports conversion (by copy) from
* map[interface{}]interface{}
Set a value for a given path.
The path must point to a map key. Setting array elements is not supported.
Slice is an alias for Array
String returns a value at key that is expected to be a string
StringArray returns a value at key that is expected to be a []string
This function supports conversion (by copy) from
* []interface{}
StringArrayMap returns a value at key that is expected to be a
map[string][]string. This function supports conversion (by copy) from
* map[interface{}][]interface{}
* map[interface{}]interface{}
* map[string]interface{}
StringMap returns a value at key that is expected to be a map[string]string.
This function supports conversion (by copy) from
* map[interface{}]interface{}
* map[string]interface{}
StringSlice is an alias for StringArray
StringSliceMap is an alias for StringArrayMap
Uint returns a value at key that is expected to be an uint64 or compatible
integer value.
Value returns a value from a given value path.
Fields can be accessed by their name. Nested fields can be accessed by using
"/" as a separator. Arrays can be addressed using the standard array
notation "[<index>]".
Examples:
"key" -> mmap["key"] single value
"key1/key2" -> mmap["key1"]["key2"] nested map
"key1[0]" -> mmap["key1"][0] nested array
"key1[0]key2" -> mmap["key1"][0]["key2"] nested array, nested map
( T) resolvePath(k string, v interface{}, action func(p, k reflect.Value, v interface{})) bool( T) resolvePathKey(key string) (int, int)
func ConvertToMarshalMap(value interface{}, formatKey func(string) string) (MarshalMap, error)
func NewMarshalMap() MarshalMap
func MarshalMap.Clone() MarshalMap
func MarshalMap.MarshalMap(key string) (MarshalMap, error)
TrieNode represents a single node inside a trie.
Each node can contain a payload which can be retrieved after a successfull
match. In addition to that PathLen will contain the length of the match.
PathLenintPayloadinterface{}children[]*TrieNodelongestPathintsuffix[]byte
Add adds a new data path to the trie.
The TrieNode returned is the (new) root node so you should always reassign
the root with the return value of Add.
ForEach applies a function to each node in the tree including and below the
passed node.
Match compares the trie to the given data stream.
Match returns true if data can be completely matched to the trie.
MatchStart compares the trie to the beginning of the given data stream.
MatchStart returns true if the beginning of data can be matched to the trie.
(*T) addNewChild(data []byte, payload interface{}, pathLen int)(*T) addPath(data []byte, payload interface{}, pathLen int, parent *TrieNode) *TrieNode(*T) replace(oldChild *TrieNode, newChild *TrieNode)
func NewTrie(data []byte, payload interface{}) *TrieNode
func (*TrieNode).Add(data []byte, payload interface{}) *TrieNode
func (*TrieNode).Match(data []byte) *TrieNode
func (*TrieNode).MatchStart(data []byte) *TrieNode
func (*TrieNode).addPath(data []byte, payload interface{}, pathLen int, parent *TrieNode) *TrieNode
func (*TrieNode).addPath(data []byte, payload interface{}, pathLen int, parent *TrieNode) *TrieNode
func (*TrieNode).replace(oldChild *TrieNode, newChild *TrieNode)
func (*TrieNode).replace(oldChild *TrieNode, newChild *TrieNode)
Uint64Slice is a typedef to allow sortable uint64 slices
IsSorted is a shortcut for sort.IsSorted(s)
( T) Len() int( T) Less(i, j int) bool
Set sets all values in this slice to the given value
Sort is a shortcut for sort.Sort(s)
( T) Swap(i, j int)
T : sort.Interface
Package-Level Functions (total 10, in which 6 are exported)
ConvertToMarshalMap tries to convert a compatible map type to a marshal map.
Compatible types are map[interface{}]interface{}, map[string]interface{} and of
course MarshalMap. The same rules as for ConvertValueToMarshalMap apply.
NewBytePool creates a new BytePool with each slab using 1 MB of storage.
The pool contains 5 slabs of different sizes: 64B, 512B, 1KB, 10KB and 100KB.
Allocations above 100KB will be allocated directly.
NewBytePoolWithSize creates a new BytePool with each slab size using n MB of
storage. See NewBytePool() for slab size details.
NewMarshalMap creates a new marshal map (string -> interface{})
NewTrie creates a new root TrieNode
TryConvertToMarshalMap converts collections to MarshalMap if possible.
This is a deep conversion, i.e. each element in the collection will be
traversed. You can pass a formatKey function that will be applied to all
string keys that are detected.
The pages are generated with Goldsv0.3.2. (GOOS=linux GOARCH=amd64)
Golds is a Go 101 project developed by Tapir Liu.
PR and bug reports are welcome and can be submitted to the issue list.
Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds.