Documentation
¶
Overview ¶
Package dictionary provides utilities for operating on map-like types.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type I ¶
type I interface {
// Get returns the value of the entry with the given key.
Get(key interface{}) (val interface{})
// Add inserts the key-value pair, replacing any existing entry with the
// same key.
Add(key, val interface{})
// Lookup searches for the value of the entry with the given key.
Lookup(key interface{}) (val interface{}, found bool)
// Contains returns true if the dictionary contains an entry with the given
// key.
Contains(key interface{}) bool
// Remove removes the entry with the given key. If no entry with the given
// key exists then this call is a no-op.
Remove(key interface{})
// Len returns the number of entries in the dictionary.
Len() int
// Keys returns all the entry keys in the map.
Keys() []interface{}
// KeyTy returns the type of all the entry keys.
KeyTy() reflect.Type
// ValTy returns the type of all the entry values.
ValTy() reflect.Type
}
I is the interface for a dictionary.
type Source ¶
type Source interface {
// Get returns the value of the entry with the given key.
Get(K) V
// Add inserts the key-value pair, replacing any existing entry with the
// same key.
Add(K, V)
// Lookup searches for the value of the entry with the given key.
Lookup(K) (val V, ok bool)
// Contains returns true if the dictionary contains an entry with the given
// key.
Contains(K) bool
// Remove removes the entry with the given key. If no entry with the given
// key exists then this call is a no-op.
Remove(K)
// Len returns the number of entries in the dictionary.
Len() int
// Keys returns all the entry keys in the map.
Keys() []K
}
Source is a placeholder interface used to prototype a generic dictionary type. K and V can be subsituted with a different type.
Click to show internal directories.
Click to hide internal directories.