Documentation ¶
Index ¶
- func Equal(a, b interface{}) bool
- func Hash(seed maphash.Seed, k Key) uint64
- func HashInterface(v interface{}) uintptr
- func SortedKeys(m map[string]interface{}) []string
- func StringKey(k Key) string
- func StringifyInterface(key interface{}) (string, error)deprecated
- type Comparable
- type Hashable
- type Key
- type Map
- func (m *Map) Del(k interface{})
- func (m *Map) Equal(other interface{}) bool
- func (m *Map) Get(k interface{}) (interface{}, bool)
- func (m *Map) Hash() uint64
- func (m *Map) Iter(f func(k, v interface{}) error) error
- func (m *Map) KeyString() string
- func (m *Map) Keys() []interface{}
- func (m *Map) Len() int
- func (m *Map) Set(k, v interface{})
- func (m *Map) String() string
- func (m *Map) Values() []interface{}
- type NonUnwrappingKey
- type Path
- type Pointer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Equal ¶
func Equal(a, b interface{}) bool
Equal compares two arbitrary interfaces for equality.
func Hash ¶
Hash will hash a key. Can be used with github.com/aristanetworks/gomap.Map.
func HashInterface ¶
func HashInterface(v interface{}) uintptr
HashInterface computes the hash of a Key
func SortedKeys ¶
SortedKeys returns the keys of the given map, in a sorted order.
func StringKey ¶
StringKey generates a String suitable to be used as a key in a string index by calling k.StringKey, if available, otherwise it calls k.String. StringKey returns the same results as StringifyInterface(k.Key()) and should be preferred over StringifyInterface.
func StringifyInterface
deprecated
Types ¶
type Comparable ¶
type Comparable interface { // Equal returns true if this object is equal to the other one. Equal(other interface{}) bool }
Comparable types have an equality-testing method.
type Key ¶
Key represents the Key in the updates and deletes of the Notification objects. The only reason this exists is that Go won't let us define our own hash function for non-hashable types, and unfortunately we need to be able to index maps by map[string]interface{} objects and slices by []interface{} objects.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map allows the indexing of entries with arbitrary key types, so long as the keys are either hashable natively or implement Hashable
func NewMap ¶
func NewMap(keysAndVals ...interface{}) *Map
NewMap creates a new Map from a list of key-value pairs, so long as the list is of even length.
func (*Map) KeyString ¶
KeyString returns a string that is suitable to be used as a key in an index of strings.
type NonUnwrappingKey ¶
type NonUnwrappingKey interface { Key NonUnwrappingKey() }
NonUnwrappingKey is just like a key, except calling key.Kew() on it returns itself. This is to prevent non-terminating recursive calls such as func myRec(val any) {
switch val.(type) { case key.NonUnwrappingKey: // something directly case key.Key: myRec(val.Key()) // never ending without the previous branch
...
type Path ¶
type Path []Key
Path represents a path decomposed into elements where each element is a Key. A Path can be interpreted as either absolute or relative depending on how it is used.
func (Path) MarshalJSON ¶
MarshalJSON marshals a Path to JSON.