Documentation ¶
Overview ¶
Package frozen provides immutable data structures.
Index ¶
- func KV(key, val interface{}) kv.KeyValue
- func KeyEqual(a, b interface{}) bool
- func StringKeyEqual(a, b interface{}) bool
- type BitIterator
- type IntIterator
- type IntLess
- type IntSet
- func (s IntSet) Any() int
- func (s IntSet) Count() int
- func (s IntSet) Elements() []int
- func (s IntSet) EqualSet(t IntSet) bool
- func (s IntSet) Has(val int) bool
- func (s IntSet) Intersection(t IntSet) IntSet
- func (s IntSet) IsEmpty() bool
- func (s IntSet) IsSubsetOf(t IntSet) bool
- func (s IntSet) Map(f func(elem int) int) IntSet
- func (s IntSet) Range() IntIterator
- func (s IntSet) String() string
- func (s IntSet) Union(t IntSet) IntSet
- func (s IntSet) Where(pred func(elem int) bool) IntSet
- func (s IntSet) With(is ...int) IntSet
- func (s IntSet) Without(is ...int) IntSet
- type Iterator
- type Key
- type KeyValue
- type Map
- func (m Map) Any() (key, value interface{})
- func (m Map) Count() int
- func (m Map) DebugReport(debug.Tag) string
- func (m Map) EqArgs() *kvt.EqArgs
- func (m Map) Equal(i interface{}) bool
- func (m Map) Format(f fmt.State, verb rune)
- func (m Map) Get(key interface{}) (interface{}, bool)
- func (m Map) GetElse(key, deflt interface{}) interface{}
- func (m Map) GetElseFunc(key interface{}, deflt func() interface{}) interface{}
- func (m Map) Has(key interface{}) bool
- func (m Map) Hash(seed uintptr) uintptr
- func (m Map) IsEmpty() bool
- func (m Map) Keys() Set
- func (m Map) Map(f func(key, val interface{}) interface{}) Map
- func (m Map) MarshalJSON() ([]byte, error)
- func (m Map) Merge(n Map, resolve func(key, a, b interface{}) interface{}) Map
- func (m Map) MustGet(key interface{}) interface{}
- func (m Map) Project(keys Set) Map
- func (m Map) Range() *MapIterator
- func (m Map) Reduce(f func(acc, key, val interface{}) interface{}, acc interface{}) interface{}
- func (m Map) String() string
- func (m Map) Update(n Map) Map
- func (m Map) Values() Set
- func (m Map) Where(pred func(key, val interface{}) bool) Map
- func (m Map) With(key, val interface{}) Map
- func (m Map) Without(keys Set) Map
- func (m Map) Without2(keys ...interface{}) Map
- type MapBuilder
- type MapIterator
- type Set
- func CartesianProduct(relations ...Set) Set
- func Intersection(sets Set) Set
- func Iota(stop int) Set
- func Iota2(start, stop int) Set
- func Iota3(start, stop, step int) Set
- func Join(relations Set) Set
- func NewRelation(header []interface{}, rows ...[]interface{}) Set
- func NewSet(values ...interface{}) Set
- func NewSetFromMask64(mask uint64) Set
- func NewSetFromStrings(values ...string) Set
- func Union(sets ...Set) Set
- func (s Set) Any() interface{}
- func (s Set) AnyN(n int) Set
- func (s Set) CartesianProduct(t Set) Set
- func (s Set) Count() int
- func (s Set) Difference(t Set) Set
- func (s Set) Elements() []interface{}
- func (s Set) Equal(t interface{}) bool
- func (s Set) EqualSet(t Set) bool
- func (s Set) First(less tree.Less) interface{}
- func (s Set) FirstN(n int, less tree.Less) Set
- func (s Set) Format(f fmt.State, verb rune)
- func (s Set) GroupBy(key func(el interface{}) interface{}) Map
- func (s Set) Has(val interface{}) bool
- func (s Set) Hash(seed uintptr) uintptr
- func (s Set) Intersection(t Set) Set
- func (s Set) IsEmpty() bool
- func (s Set) IsSubsetOf(t Set) bool
- func (s Set) Join(t Set) Set
- func (s Set) Map(f func(elem interface{}) interface{}) Set
- func (s Set) MarshalJSON() ([]byte, error)
- func (s Set) Nest(attrAttrs Map) Set
- func (s Set) OrderedElements(less tree.Less) []interface{}
- func (s Set) OrderedFirstN(n int, less tree.Less) []interface{}
- func (s Set) OrderedRange(less tree.Less) iterator.Iterator
- func (s Set) Powerset() Set
- func (s Set) Project(attrs Set) Set
- func (s Set) Range() iterator.Iterator
- func (s Set) Reduce(reduce func(elems ...interface{}) interface{}) interface{}
- func (s Set) Reduce2(reduce func(a, b interface{}) interface{}) interface{}
- func (s Set) String() string
- func (s Set) SymmetricDifference(t Set) Set
- func (s Set) Union(t Set) Set
- func (s Set) Unnest(attrs Set) Set
- func (s Set) Where(pred func(elem interface{}) bool) Set
- func (s Set) With(values ...interface{}) Set
- func (s Set) Without(values ...interface{}) Set
- type SetBuilder
- type StringMap
- func (m StringMap) Any() (key, value interface{})
- func (m StringMap) Count() int
- func (m StringMap) EqArgs() *skvt.EqArgs
- func (m StringMap) Equal(i interface{}) bool
- func (m StringMap) Format(f fmt.State, verb rune)
- func (m StringMap) Get(key string) (interface{}, bool)
- func (m StringMap) GetElse(key string, deflt interface{}) interface{}
- func (m StringMap) GetElseFunc(key string, deflt func() interface{}) interface{}
- func (m StringMap) Has(key string) bool
- func (m StringMap) Hash(seed uintptr) uintptr
- func (m StringMap) IsEmpty() bool
- func (m StringMap) Keys() Set
- func (m StringMap) MarshalJSON() ([]byte, error)
- func (m StringMap) Merge(n StringMap, resolve func(key string, a, b interface{}) interface{}) StringMap
- func (m StringMap) MustGet(key string) interface{}
- func (m StringMap) Project(keys Set) StringMap
- func (m StringMap) Range() *StringMapIterator
- func (m StringMap) Reduce(f func(acc, key, val interface{}) interface{}, acc interface{}) interface{}
- func (m StringMap) String() string
- func (m StringMap) StringMap(f func(key, val interface{}) interface{}) StringMap
- func (m StringMap) Update(n StringMap) StringMap
- func (m StringMap) Values() Set
- func (m StringMap) Where(pred func(key string, val interface{}) bool) StringMap
- func (m StringMap) With(key string, val interface{}) StringMap
- func (m StringMap) Without(keys Set) StringMap
- func (m StringMap) Without2(keys ...string) StringMap
- type StringMapBuilder
- func (b *StringMapBuilder) Count() int
- func (b *StringMapBuilder) Finish() StringMap
- func (b *StringMapBuilder) Get(key string) (interface{}, bool)
- func (b *StringMapBuilder) Has(v string) bool
- func (b *StringMapBuilder) Put(key string, value interface{})
- func (b *StringMapBuilder) Remove(key string)
- type StringMapIterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StringKeyEqual ¶ added in v0.20.0
func StringKeyEqual(a, b interface{}) bool
Types ¶
type BitIterator ¶
type BitIterator uintptr
BitIterator represents a set of one-bits and the ability to enumerate them.
func (BitIterator) Count ¶
func (b BitIterator) Count() int
func (BitIterator) Has ¶
func (b BitIterator) Has(i int) bool
func (BitIterator) Index ¶
func (b BitIterator) Index() int
func (BitIterator) Next ¶
func (b BitIterator) Next() BitIterator
func (BitIterator) String ¶
func (b BitIterator) String() string
func (BitIterator) With ¶
func (b BitIterator) With(i int) BitIterator
func (BitIterator) Without ¶
func (b BitIterator) Without(i int) BitIterator
type IntIterator ¶
type IntSet ¶
type IntSet struct {
// contains filtered or unexported fields
}
func (IntSet) Intersection ¶
Intersection returns an IntSet whose values exists in s and t.
func (IntSet) IsSubsetOf ¶
IsSubsetOf returns true if s is a subset of t and false otherwise.
type Map ¶
type Map struct {
// contains filtered or unexported fields
}
Map maps keys to values. The zero value is the empty Map.
func NewMapFromGoMap ¶
func NewMapFromGoMap(m map[interface{}]interface{}) Map
NewMapFromGoMap takes a map[interface{}]interface{} and returns a frozen Map from it.
func NewMapFromKeys ¶
NewMapFromKeys creates a new Map in which values are computed from keys.
func (Map) Any ¶
func (m Map) Any() (key, value interface{})
Any returns an arbitrary entry from the Map.
func (Map) DebugReport ¶ added in v0.20.0
DebugReport is for internal use.
func (Map) GetElse ¶
func (m Map) GetElse(key, deflt interface{}) interface{}
GetElse returns the value associated with key in m or deflt if the key is not found.
func (Map) GetElseFunc ¶
func (m Map) GetElseFunc(key interface{}, deflt func() interface{}) interface{}
GetElseFunc returns the value associated with key in m or the result of calling deflt if the key is not found.
func (Map) Map ¶
Map returns a Map with keys from this Map, but the values replaced by the result of calling f.
func (Map) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Map) Merge ¶
Merge returns a map from the merging between two maps, should there be a key overlap, the value that corresponds to key will be replaced by the value resulted from the provided resolve function.
func (Map) MustGet ¶
func (m Map) MustGet(key interface{}) interface{}
MustGet returns the value associated with key in m or panics if the key is not found.
func (Map) Reduce ¶
func (m Map) Reduce(f func(acc, key, val interface{}) interface{}, acc interface{}) interface{}
Reduce returns the result of applying f to each key-value pair on the Map. The result of each call is used as the acc argument for the next element.
func (Map) Update ¶
Update returns a Map with key-value pairs from n added or replacing existing keys.
func (Map) With ¶
With returns a new Map with key associated with val and all other keys retained from m.
type MapBuilder ¶
type MapBuilder struct {
// contains filtered or unexported fields
}
MapBuilder provides a more efficient way to build Maps incrementally.
func NewMapBuilder ¶
func NewMapBuilder(capacity int) *MapBuilder
func (*MapBuilder) Count ¶
func (b *MapBuilder) Count() int
Count returns the number of entries in the Map under construction.
func (*MapBuilder) Finish ¶
func (b *MapBuilder) Finish() Map
Finish returns a Map containing all entries added since the MapBuilder was initialised or the last call to Finish.
func (*MapBuilder) Get ¶
func (b *MapBuilder) Get(key interface{}) (interface{}, bool)
Get returns the value for key from the Map under construction or false if not found.
func (*MapBuilder) Has ¶ added in v0.20.0
func (b *MapBuilder) Has(v interface{}) bool
func (*MapBuilder) Put ¶
func (b *MapBuilder) Put(key, value interface{})
Put adds or changes an entry into the Map under construction.
func (*MapBuilder) Remove ¶
func (b *MapBuilder) Remove(key interface{})
Remove removes an entry from the Map under construction.
type MapIterator ¶
type MapIterator struct {
// contains filtered or unexported fields
}
MapIterator provides for iterating over a Map.
func (*MapIterator) Entry ¶
func (i *MapIterator) Entry() (key, value interface{})
Entry returns the current key-value pair as two return values.
func (*MapIterator) Key ¶
func (i *MapIterator) Key() interface{}
Key returns the key for the current entry.
func (*MapIterator) Next ¶
func (i *MapIterator) Next() bool
Next moves to the next key-value pair or returns false if there are no more.
func (*MapIterator) Value ¶
func (i *MapIterator) Value() interface{}
Value returns the value for the current entry.
type Set ¶
type Set struct {
// contains filtered or unexported fields
}
Set holds a set of values. The zero value is the empty Set.
func CartesianProduct ¶
func Intersection ¶
Intersection returns the n-ary intersection of a Set of Sets.
func Iota3 ¶
Iota3 returns a Set with elements {start, start+step, start+2*step, ...} up to but not including stop. Negative steps are allowed.
func NewRelation ¶
func NewRelation(header []interface{}, rows ...[]interface{}) Set
NewRelation returns a new set of maps, each having the same keys.
func NewSet ¶
func NewSet(values ...interface{}) Set
NewSet creates a new Set with values as elements.
func NewSetFromMask64 ¶
NewSetFromMask64 returns a Set containing all elements 2**i such that bit i of mask is set.
func NewSetFromStrings ¶
NewSetFromStrings creates a new Set with values as elements.
func (Set) CartesianProduct ¶
func (Set) Difference ¶
Difference returns a Set with all elements that are s but not in t.
func (Set) Intersection ¶
Intersection returns a Set with all elements that are in both s and t.
func (Set) IsSubsetOf ¶
IsSubsetOf returns true iff no element in s is not in t.
func (Set) Join ¶
Join returns all {x, y, z} such that s has {x, y} and t has {y, z}. x, y and z represent sets of keys:
x: keys unique to maps in s y: keys common to maps in both z: keys unique to maps in t
It is assumed that all maps in s have the same keys and likewise for t.
func (Set) MarshalJSON ¶
MarshalJSON implements json.Marshaler.
func (Set) Nest ¶
Nest returns a relation with some attributes nested as subrelations.
Example:
input: _c_ _a__ |_1_|_10_| |_1_|_11_| |_2_|_13_| |_3_|_11_| |_4_|_14_| |_3_|_10_| |_4_|_13_| nest(input, ("aa": {"a"})): _c_ ___aa___ | 1 | _a__ | | | |_10_| | |___|_|_11_|_| | 2 | _a__ | |___|_|_13_|_| | 3 | _a__ | | | |_10_| | |___|_|_11_|_| | 4 | _a__ | | | |_13_| | |___|_|_14_|_|
func (Set) OrderedElements ¶
OrderedElements takes elements in a defined order.
func (Set) OrderedFirstN ¶
OrderedFirstN returns a list of elements in a defined order.
func (Set) OrderedRange ¶
OrderedRange returns a SetIterator for the Set that iterates over the elements in a specified order.
func (Set) Reduce ¶
func (s Set) Reduce(reduce func(elems ...interface{}) interface{}) interface{}
Reduce returns the result of applying `reduce` to the elements of `s` or `nil` if `s.IsEmpty()`. The result of each call is used as the acc argument for the next element.
The `reduce` function must have the following properties:
- commutative: `reduce(a, b, c) == reduce(c, a, b)`
- associative: `reduce(reduce(a, b), c) == reduce(a, reduce(b, c))`
By implication, `reduce` must accept its own output as input.
'elems` will never be empty.
func (Set) Reduce2 ¶
func (s Set) Reduce2(reduce func(a, b interface{}) interface{}) interface{}
Reduce2 is a convenience wrapper for `Reduce`, allowing the caller to implement a simpler, albeit less efficient, binary `reduce` function instead of an n-adic one.
func (Set) SymmetricDifference ¶
SymmetricDifference returns a Set with all elements that are s or t, but not both.
func (Set) Unnest ¶
Unnest returns a relation with some subrelations unnested. This is the reverse of Nest.
type SetBuilder ¶
type SetBuilder struct {
// contains filtered or unexported fields
}
SetBuilder provides a more efficient way to build sets incrementally.
func NewSetBuilder ¶
func NewSetBuilder(capacity int) *SetBuilder
func (*SetBuilder) Add ¶
func (b *SetBuilder) Add(v interface{})
Add adds el to the Set under construction.
func (*SetBuilder) Count ¶
func (b *SetBuilder) Count() int
Count returns the count of the Set that will be returned from Finish().
func (*SetBuilder) Finish ¶
func (b *SetBuilder) Finish() Set
Finish returns a Set containing all elements added since the SetBuilder was initialised or the last call to Finish.
func (*SetBuilder) Has ¶
func (b *SetBuilder) Has(v interface{}) bool
func (*SetBuilder) Remove ¶
func (b *SetBuilder) Remove(v interface{})
Remove removes el to the Set under construction.
func (SetBuilder) String ¶ added in v0.20.0
func (b SetBuilder) String() string
type StringMap ¶ added in v0.17.0
type StringMap struct {
// contains filtered or unexported fields
}
StringMap maps keys to values. The zero value is the empty StringMap.
func NewStringMap ¶ added in v0.17.0
NewStringMap creates a new StringMap with kvs as keys and values.
func NewStringMapFromGoMap ¶ added in v0.20.0
NewStringMapFromGoMap takes a map[interface{}]interface{} and returns a frozen StringMap from it.
func NewStringMapFromKeys ¶ added in v0.20.0
NewStringMapFromKeys creates a new StringMap in which values are computed from keys.
func (StringMap) Any ¶ added in v0.17.0
func (m StringMap) Any() (key, value interface{})
Any returns an arbitrary entry from the StringMap.
func (StringMap) Equal ¶ added in v0.17.0
Equal returns true iff i is a StringMap with all the same key-value pairs as this StringMap.
func (StringMap) Format ¶ added in v0.17.0
Format writes a string representation of the StringMap into state.
func (StringMap) Get ¶ added in v0.17.0
Get returns the value associated with key in m and true iff the key is found.
func (StringMap) GetElse ¶ added in v0.17.0
GetElse returns the value associated with key in m or deflt if the key is not found.
func (StringMap) GetElseFunc ¶ added in v0.17.0
GetElseFunc returns the value associated with key in m or the result of calling deflt if the key is not found.
func (StringMap) MarshalJSON ¶ added in v0.17.0
MarshalJSON implements json.Marshaler.
func (StringMap) Merge ¶ added in v0.17.0
func (m StringMap) Merge(n StringMap, resolve func(key string, a, b interface{}) interface{}) StringMap
Merge returns a map from the merging between two maps, should there be a key overlap, the value that corresponds to key will be replaced by the value resulted from the provided resolve function.
func (StringMap) MustGet ¶ added in v0.17.0
MustGet returns the value associated with key in m or panics if the key is not found.
func (StringMap) Project ¶ added in v0.17.0
Project returns a StringMap with only keys included from this StringMap.
func (StringMap) Range ¶ added in v0.17.0
func (m StringMap) Range() *StringMapIterator
Range returns a StringMapIterator over the StringMap.
func (StringMap) Reduce ¶ added in v0.17.0
func (m StringMap) Reduce(f func(acc, key, val interface{}) interface{}, acc interface{}) interface{}
Reduce returns the result of applying f to each key-value pair on the StringMap. The result of each call is used as the acc argument for the next element.
func (StringMap) StringMap ¶ added in v0.17.0
StringMap returns a StringMap with keys from this StringMap, but the values replaced by the result of calling f.
func (StringMap) Update ¶ added in v0.17.0
Update returns a StringMap with key-value pairs from n added or replacing existing keys.
func (StringMap) Values ¶ added in v0.17.0
Values returns a Set with all the Values in the StringMap.
func (StringMap) Where ¶ added in v0.17.0
Where returns a StringMap with only key-value pairs satisfying pred.
func (StringMap) With ¶ added in v0.17.0
With returns a new StringMap with key associated with val and all other keys retained from m.
type StringMapBuilder ¶ added in v0.17.0
type StringMapBuilder struct {
// contains filtered or unexported fields
}
StringMapBuilder provides a more efficient way to build Maps incrementally.
func NewStringMapBuilder ¶ added in v0.17.0
func NewStringMapBuilder(capacity int) *StringMapBuilder
func (*StringMapBuilder) Count ¶ added in v0.17.0
func (b *StringMapBuilder) Count() int
Count returns the number of entries in the StringMap under construction.
func (*StringMapBuilder) Finish ¶ added in v0.17.0
func (b *StringMapBuilder) Finish() StringMap
Finish returns a StringMap containing all entries added since the StringMapBuilder was initialised or the last call to Finish.
func (*StringMapBuilder) Get ¶ added in v0.17.0
func (b *StringMapBuilder) Get(key string) (interface{}, bool)
Get returns the value for key from the StringMap under construction or false if not found.
func (*StringMapBuilder) Has ¶ added in v0.20.0
func (b *StringMapBuilder) Has(v string) bool
func (*StringMapBuilder) Put ¶ added in v0.17.0
func (b *StringMapBuilder) Put(key string, value interface{})
Put adds or changes an entry into the StringMap under construction.
func (*StringMapBuilder) Remove ¶ added in v0.17.0
func (b *StringMapBuilder) Remove(key string)
Remove removes an entry from the StringMap under construction.
type StringMapIterator ¶ added in v0.17.0
type StringMapIterator struct {
// contains filtered or unexported fields
}
StringMapIterator provides for iterating over a StringMap.
func (*StringMapIterator) Entry ¶ added in v0.17.0
func (i *StringMapIterator) Entry() (key string, value interface{})
Entry returns the current key-value pair as two return values.
func (*StringMapIterator) Key ¶ added in v0.17.0
func (i *StringMapIterator) Key() string
Key returns the key for the current entry.
func (*StringMapIterator) Next ¶ added in v0.17.0
func (i *StringMapIterator) Next() bool
Next moves to the next key-value pair or returns false if there are no more.
func (*StringMapIterator) Value ¶ added in v0.17.0
func (i *StringMapIterator) Value() interface{}
Value returns the value for the current entry.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
iterator/kvi
Generated by gen-kv.pl kvi kv.KeyValue.
|
Generated by gen-kv.pl kvi kv.KeyValue. |
iterator/skvi
Generated by gen-kv.pl skvi kv.KeyValue.
|
Generated by gen-kv.pl skvi kv.KeyValue. |
tree/kvt
Generated by gen-kv.pl kvt kv.KeyValue.
|
Generated by gen-kv.pl kvt kv.KeyValue. |
tree/skvt
Generated by gen-kv.pl skvt kv.KeyValue.
|
Generated by gen-kv.pl skvt kv.KeyValue. |
pkg
|
|