import "github.com/marcsantiago/collections"
- func StringEncoder(encoder *bytes.Buffer, data Data, t Type)
- type CounterMap
- type Data
- type Element
- type ElementsByKeyIntAsc
- type ElementsByKeyIntDesc
- type ElementsByKeyStringAsc
- type ElementsByKeyStringDesc
- type ElementsByValueIntAsc
- type ElementsByValueIntDesc
- type ElementsByValueStringAsc
- type ElementsByValueStringDesc
- type FloatValue32
- type FloatValue64
- type FloatValues32
- type FloatValues64
- type GenericMap
- func NewGenericMap() GenericMap
- func (i GenericMap) Delete(key Data)
- func (i GenericMap) Get(key Data) (Data, bool)
- func (i GenericMap) Items() []Element
- func (i GenericMap) Iterate() <-chan Element
- func (i GenericMap) Len() int
- func (i GenericMap) Set(key Data, value Data)
- func (i GenericMap) String() string
- type IntValue
- type IntValue32
- type IntValue64
- type IntValues
- type IntValues32
- type IntValues64
- type Iterable
- type Map
- type RuneValue
- type RuneValues
- type StringValue
- type StringValues
- type Type
data.go element_sorters.go generic_map.go interable.go map.go primitive_conversions.go string_encoder.go types.go
func StringEncoder(encoder *bytes.Buffer, data Data, t Type)StringEncoder writes data into a bytes buffer, used in the String method
type CounterMap interface {
Map
MostCommon(n int) []Element
Subtract(value Data)
Update(value Data)
}CounterMap mimics the Python Counter definitions this also implements the collections.Map interface to be able to convert into a ChainMap
type Data interface {
Int() int
Int32() int32
Int64() int64
Float32() float32
Float64() float64
String() string
}Data interface for casting and getting data values used to avoid reflection
type Element struct {
Key Data
Value Data
}Element represents (key, value) with backed by the Data interface
type ElementsByKeyIntAsc []ElementElementsByKeyIntAsc used to used low to high where key is of type string
func (e ElementsByKeyIntAsc) Len() intfunc (e ElementsByKeyIntAsc) Less(i, j int) boolfunc (e ElementsByKeyIntAsc) Swap(i, j int)type ElementsByKeyIntDesc []ElementElementsByKeyIntDesc used to used high to low where key is of type string
func (e ElementsByKeyIntDesc) Len() intfunc (e ElementsByKeyIntDesc) Less(i, j int) boolfunc (e ElementsByKeyIntDesc) Swap(i, j int)type ElementsByKeyStringAsc []ElementElementsByKeyStringAsc used to used low to high where key is of type string
func (e ElementsByKeyStringAsc) Len() intfunc (e ElementsByKeyStringAsc) Less(i, j int) boolfunc (e ElementsByKeyStringAsc) Swap(i, j int)type ElementsByKeyStringDesc []ElementElementsByKeyStringDesc used to used high to low where key is of type string
func (e ElementsByKeyStringDesc) Len() intfunc (e ElementsByKeyStringDesc) Less(i, j int) boolfunc (e ElementsByKeyStringDesc) Swap(i, j int)type ElementsByValueIntAsc []ElementElementsByValueIntAsc used to used low to high where value is of type string
func (e ElementsByValueIntAsc) Len() intfunc (e ElementsByValueIntAsc) Less(i, j int) boolfunc (e ElementsByValueIntAsc) Swap(i, j int)type ElementsByValueIntDesc []ElementElementsByValueIntDesc used to used high to low where value is of type string
func (e ElementsByValueIntDesc) Len() intfunc (e ElementsByValueIntDesc) Less(i, j int) boolfunc (e ElementsByValueIntDesc) Swap(i, j int)type ElementsByValueStringAsc []ElementElementsByValueStringAsc used to used low to high where value is of type string
func (e ElementsByValueStringAsc) Len() intfunc (e ElementsByValueStringAsc) Less(i, j int) boolfunc (e ElementsByValueStringAsc) Swap(i, j int)type ElementsByValueStringDesc []ElementElementsByValueStringDesc used to used high to low where value is of type string
func (e ElementsByValueStringDesc) Len() intfunc (e ElementsByValueStringDesc) Less(i, j int) boolfunc (e ElementsByValueStringDesc) Swap(i, j int)type FloatValue32 float32FloatValue32 type alias for int
func (i FloatValue32) Float32() float32Float32 casts and returns Float32 value
func (i FloatValue32) Float64() float64Float64 casts and returns Float64 value
func (i FloatValue32) Int() intInt casts and returns int value
func (i FloatValue32) Int32() int32Int32 casts and returns Int32 value
func (i FloatValue32) Int64() int64Int64 casts and returns Int64 value
func (i FloatValue32) String() stringString casts and returns string value
type FloatValue64 float64FloatValue64 type alias for int
func (i FloatValue64) Float32() float32Float32 casts and returns Float32 value
func (i FloatValue64) Float64() float64Float64 casts and returns Float64 value
func (i FloatValue64) Int() intInt casts and returns int value
func (i FloatValue64) Int32() int32Int32 casts and returns Int32 value
func (i FloatValue64) Int64() int64Int64 casts and returns Int64 value
func (i FloatValue64) String() stringString casts and returns string value
type FloatValues32 []float32FloatValues32 type alias for a slice of IntValue
func (i FloatValues32) Data() []Datatype FloatValues64 []float32FloatValues64 type alias for a slice of IntValue
func (i FloatValues64) Data() []Datatype GenericMap map[Data]DataGenericMap is the default implementation of a map using the Data interface
func NewGenericMap() GenericMapfunc (i GenericMap) Delete(key Data)Delete removes the element from the internal map
func (i GenericMap) Get(key Data) (Data, bool)Get retrieves a data value from the internal map if it exists
func (i GenericMap) Items() []ElementItems returns the internal map as a set of elements
func (i GenericMap) Iterate() <-chan ElementIterate creates a channel to create an iterator for he Go range statement
func (i GenericMap) Len() intLen returns the number of stored keys
func (i GenericMap) Set(key Data, value Data)Set adds a key value pairing to the internal map
func (i GenericMap) String() stringString returns the JSON string representation of the map data
type IntValue intIntValue type alias for int
func (i IntValue) Float32() float32Float32 casts and returns Float32 value
func (i IntValue) Float64() float64Float64 casts and returns Float64 value
func (i IntValue) Int() intInt casts and returns int value
func (i IntValue) Int32() int32Int32 casts and returns Int32 value
func (i IntValue) Int64() int64Int64 casts and returns Int64 value
func (i IntValue) String() stringString casts and returns string value
type IntValue32 int32IntValue32 type alias for int
func (i IntValue32) Float32() float32Float32 casts and returns Float32 value
func (i IntValue32) Float64() float64Float64 casts and returns Float64 value
func (i IntValue32) Int() intInt casts and returns int value
func (i IntValue32) Int32() int32Int32 casts and returns Int32 value
func (i IntValue32) Int64() int64Int64 casts and returns Int64 value
func (i IntValue32) String() stringString casts and returns string value
type IntValue64 int64IntValue64 type alias for int
func (i IntValue64) Float32() float32Float32 casts and returns Float32 value
func (i IntValue64) Float64() float64Float64 casts and returns Float64 value
func (i IntValue64) Int() intInt casts and returns int value
func (i IntValue64) Int32() int32Int32 casts and returns Int32 value
func (i IntValue64) Int64() int64Int64 casts and returns Int64 value
func (i IntValue64) String() stringString casts and returns string value
type IntValues []intIntValues type alias for a slice of IntValue
func (i IntValues) Data() []Datatype IntValues32 []int32IntValues32 type alias for a slice of IntValue
func (i IntValues32) Data() []Datatype IntValues64 []int64IntValues64 type alias for a slice of IntValue
func (i IntValues64) Data() []Datatype Iterable interface {
Iterate() <-chan Element
}Iterable is anything that can be ranged on
type Map interface {
Iterable
Delete(key Data)
Get(key Data) (Data, bool)
Len() int
Set(key Data, value Data)
String() string
Items() []Element
}Map is a genetic map
type RuneValue runeRuneValue type alias for rune
func (s RuneValue) Float32() float32Float32 casts and returns Float32 value
func (s RuneValue) Float64() float64Float64 casts and returns Float64 value
func (s RuneValue) Int() intInt casts and returns int value
func (s RuneValue) Int32() int32Int32 casts and returns Int32 value
func (s RuneValue) Int64() int64Int64 casts and returns Int64 value
func (s RuneValue) String() stringString casts and returns string value
type RuneValues []runeRuneValues type alias for a slice of RuneValue
func (s RuneValues) Data() []Datatype StringValue stringStringValue type alias for string
func (s StringValue) Float32() float32Float32 casts and returns Float32 value
func (s StringValue) Float64() float64Float64 casts and returns Float64 value
func (s StringValue) Int() intInt casts and returns int value
func (s StringValue) Int32() int32Int32 casts and returns Int32 value
func (s StringValue) Int64() int64Int64 casts and returns Int64 value
func (s StringValue) String() stringString casts and returns string value
type StringValues []stringStringValues type alias for a slice of StringValue
func (s StringValues) Data() []Datatype Type intType is a type alias for an int used for the "ENUM" definition below
const (
UnknownType Type = iota
IntType
Int32Type
Int64Type
Float32Type
Float64Type
StringType
IntSliceType
Int32SliceType
Int64SliceType
Float32SliceType
Float64SliceType
StringSliceType
)Collection supported types
func DetermineDataType(data Data) TypeDetermineDataType gets the internal data type converts it to a supported collections type note this does use reflection
Generated by godoc2md