Documentation ¶
Overview ¶
Package generic_types contains underlying Go implementation of types that will be used in text templates to generate specific implementations.
Index ¶
- type GenericMapItem
- type GenericMapKeyType
- type GenericMapType
- func (m *GenericMapType) Delete(key GenericMapKeyType) *GenericMapType
- func (m *GenericMapType) Len() int
- func (m *GenericMapType) Load(key GenericMapKeyType) (value GenericMapValueType, ok bool)
- func (m *GenericMapType) Range(f func(GenericMapKeyType, GenericMapValueType) bool)
- func (m *GenericMapType) Store(key GenericMapKeyType, value GenericMapValueType) *GenericMapType
- func (m *GenericMapType) ToNativeMap() map[GenericMapKeyType]GenericMapValueType
- type GenericMapValueType
- type GenericSetType
- func (s *GenericSetType) Add(item GenericMapKeyType) *GenericSetType
- func (s *GenericSetType) Contains(item GenericMapKeyType) bool
- func (s *GenericSetType) Delete(item GenericMapKeyType) *GenericSetType
- func (s *GenericSetType) Difference(other *GenericSetType) *GenericSetType
- func (s *GenericSetType) Equals(other *GenericSetType) bool
- func (s *GenericSetType) Intersection(other *GenericSetType) *GenericSetType
- func (s *GenericSetType) IsSubset(other *GenericSetType) bool
- func (s *GenericSetType) IsSuperset(other *GenericSetType) bool
- func (s *GenericSetType) Len() int
- func (s *GenericSetType) Range(f func(GenericMapKeyType) bool)
- func (s *GenericSetType) SymmetricDifference(other *GenericSetType) *GenericSetType
- func (s *GenericSetType) ToNativeSlice() []GenericMapKeyType
- func (s *GenericSetType) Union(other *GenericSetType) *GenericSetType
- type GenericType
- type GenericVectorType
- func (v *GenericVectorType) Append(item ...GenericType) *GenericVectorType
- func (v *GenericVectorType) Get(i int) GenericType
- func (v *GenericVectorType) Len() int
- func (v *GenericVectorType) Range(f func(GenericType) bool)
- func (v *GenericVectorType) Set(i int, item GenericType) *GenericVectorType
- func (v *GenericVectorType) Slice(start, stop int) *GenericVectorTypeSlice
- func (v *GenericVectorType) ToNativeSlice() []GenericType
- type GenericVectorTypeSlice
- func (s *GenericVectorTypeSlice) Append(items ...GenericType) *GenericVectorTypeSlice
- func (s *GenericVectorTypeSlice) Get(i int) GenericType
- func (s *GenericVectorTypeSlice) Len() int
- func (s *GenericVectorTypeSlice) Range(f func(GenericType) bool)
- func (s *GenericVectorTypeSlice) Set(i int, item GenericType) *GenericVectorTypeSlice
- func (s *GenericVectorTypeSlice) Slice(start, stop int) *GenericVectorTypeSlice
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericMapItem ¶
type GenericMapItem struct { Key GenericMapKeyType Value GenericMapValueType }
type GenericMapKeyType ¶
type GenericMapKeyType int
GenericMapKeyType is a placeholder for types used as keys in maps or values in slices.
type GenericMapType ¶
type GenericMapType struct {
// contains filtered or unexported fields
}
GenericMapType is a persistent key - value map
func NewGenericMapType ¶
func NewGenericMapType(items ...GenericMapItem) *GenericMapType
NewGenericMapType returns a new GenericMapType containing all items in items.
func NewGenericMapTypeFromNativeMap ¶
func NewGenericMapTypeFromNativeMap(m map[GenericMapKeyType]GenericMapValueType) *GenericMapType
NewGenericMapTypeFromNativeMap returns a new GenericMapType containing all items in m.
func (*GenericMapType) Delete ¶
func (m *GenericMapType) Delete(key GenericMapKeyType) *GenericMapType
Delete returns a new GenericMapType without the element identified by key.
func (*GenericMapType) Len ¶
func (m *GenericMapType) Len() int
Len returns the number of items in m.
func (*GenericMapType) Load ¶
func (m *GenericMapType) Load(key GenericMapKeyType) (value GenericMapValueType, ok bool)
Load returns value identified by key. ok is set to true if key exists in the map, false otherwise.
func (*GenericMapType) Range ¶
func (m *GenericMapType) Range(f func(GenericMapKeyType, GenericMapValueType) bool)
Range calls f repeatedly passing it each key and value as argument until either all elements have been visited or f returns false.
func (*GenericMapType) Store ¶
func (m *GenericMapType) Store(key GenericMapKeyType, value GenericMapValueType) *GenericMapType
Store returns a new GenericMapType containing value identified by key.
func (*GenericMapType) ToNativeMap ¶
func (m *GenericMapType) ToNativeMap() map[GenericMapKeyType]GenericMapValueType
ToNativeMap returns a native Go map containing all elements of m.
type GenericMapValueType ¶
type GenericMapValueType int
GenericMapValueType is a placeholder for types used as values in maps.
type GenericSetType ¶
type GenericSetType struct {
// contains filtered or unexported fields
}
GenericSetType is a persistent set
func NewGenericSetType ¶
func NewGenericSetType(items ...GenericMapKeyType) *GenericSetType
NewGenericSetType returns a new GenericSetType containing items.
func (*GenericSetType) Add ¶
func (s *GenericSetType) Add(item GenericMapKeyType) *GenericSetType
Add returns a new GenericSetType containing item.
func (*GenericSetType) Contains ¶
func (s *GenericSetType) Contains(item GenericMapKeyType) bool
Contains returns true if item is present in s, false otherwise.
func (*GenericSetType) Delete ¶
func (s *GenericSetType) Delete(item GenericMapKeyType) *GenericSetType
Delete returns a new GenericSetType without item.
func (*GenericSetType) Difference ¶
func (s *GenericSetType) Difference(other *GenericSetType) *GenericSetType
Difference returns a new GenericSetType containing all elements present in s but not in other.
func (*GenericSetType) Equals ¶
func (s *GenericSetType) Equals(other *GenericSetType) bool
Equals returns true if s and other contains the same elements, false otherwise.
func (*GenericSetType) Intersection ¶
func (s *GenericSetType) Intersection(other *GenericSetType) *GenericSetType
Intersection returns a new GenericSetType containing all elements present in both s and other.
func (*GenericSetType) IsSubset ¶
func (s *GenericSetType) IsSubset(other *GenericSetType) bool
IsSubset returns true if all elements in s are present in other, false otherwise.
func (*GenericSetType) IsSuperset ¶
func (s *GenericSetType) IsSuperset(other *GenericSetType) bool
IsSuperset returns true if all elements in other are present in s, false otherwise.
func (*GenericSetType) Len ¶
func (s *GenericSetType) Len() int
Len returns the number of elements in s.
func (*GenericSetType) Range ¶
func (s *GenericSetType) Range(f func(GenericMapKeyType) bool)
Range calls f repeatedly passing it each element in s as argument until either all elements have been visited or f returns false.
func (*GenericSetType) SymmetricDifference ¶
func (s *GenericSetType) SymmetricDifference(other *GenericSetType) *GenericSetType
SymmetricDifference returns a new GenericSetType containing all elements present in either s or other but not both.
func (*GenericSetType) ToNativeSlice ¶
func (s *GenericSetType) ToNativeSlice() []GenericMapKeyType
ToNativeSlice returns a native Go slice containing all elements of s.
func (*GenericSetType) Union ¶
func (s *GenericSetType) Union(other *GenericSetType) *GenericSetType
Union returns a new GenericSetType containing all elements present in either s or other.
type GenericType ¶
type GenericType int
GenericType is a placeholder for types contained in vectors or slices.
type GenericVectorType ¶
type GenericVectorType struct {
// contains filtered or unexported fields
}
A GenericVectorType is an ordered persistent/immutable collection of items corresponding roughly to the use cases for a slice.
func NewGenericVectorType ¶
func NewGenericVectorType(items ...GenericType) *GenericVectorType
NewGenericVectorType returns a new GenericVectorType containing the items provided in items.
func (*GenericVectorType) Append ¶
func (v *GenericVectorType) Append(item ...GenericType) *GenericVectorType
Append returns a new vector with item(s) appended to it.
func (*GenericVectorType) Get ¶
func (v *GenericVectorType) Get(i int) GenericType
Get returns the element at position i.
func (*GenericVectorType) Range ¶
func (v *GenericVectorType) Range(f func(GenericType) bool)
Range calls f repeatedly passing it each element in v in order as argument until either all elements have been visited or f returns false.
func (*GenericVectorType) Set ¶
func (v *GenericVectorType) Set(i int, item GenericType) *GenericVectorType
Set returns a new vector with the element at position i set to item.
func (*GenericVectorType) Slice ¶
func (v *GenericVectorType) Slice(start, stop int) *GenericVectorTypeSlice
Slice returns a GenericVectorTypeSlice that refers to all elements [start,stop) in v.
func (*GenericVectorType) ToNativeSlice ¶
func (v *GenericVectorType) ToNativeSlice() []GenericType
ToNativeSlice returns a Go slice containing all elements of v
type GenericVectorTypeSlice ¶
type GenericVectorTypeSlice struct {
// contains filtered or unexported fields
}
GenericVectorTypeSlice is a slice type backed by a GenericVectorType.
func NewGenericVectorTypeSlice ¶
func NewGenericVectorTypeSlice(items ...GenericType) *GenericVectorTypeSlice
NewGenericVectorTypeSlice returns a new NewGenericVectorTypeSlice containing the items provided in items.
func (*GenericVectorTypeSlice) Append ¶
func (s *GenericVectorTypeSlice) Append(items ...GenericType) *GenericVectorTypeSlice
Append returns a new slice with item(s) appended to it.
func (*GenericVectorTypeSlice) Get ¶
func (s *GenericVectorTypeSlice) Get(i int) GenericType
Get returns the element at position i.
func (*GenericVectorTypeSlice) Len ¶
func (s *GenericVectorTypeSlice) Len() int
Len returns the length of s.
func (*GenericVectorTypeSlice) Range ¶
func (s *GenericVectorTypeSlice) Range(f func(GenericType) bool)
Range calls f repeatedly passing it each element in s in order as argument until either all elements have been visited or f returns false.
func (*GenericVectorTypeSlice) Set ¶
func (s *GenericVectorTypeSlice) Set(i int, item GenericType) *GenericVectorTypeSlice
Set returns a new slice with the element at position i set to item.
func (*GenericVectorTypeSlice) Slice ¶
func (s *GenericVectorTypeSlice) Slice(start, stop int) *GenericVectorTypeSlice
Slice returns a GenericVectorTypeSlice that refers to all elements [start,stop) in s.