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 []Element
ElementsByKeyIntAsc used to used low to high where key is of type string
func (e ElementsByKeyIntAsc) Len() int
func (e ElementsByKeyIntAsc) Less(i, j int) bool
func (e ElementsByKeyIntAsc) Swap(i, j int)
type ElementsByKeyIntDesc []Element
ElementsByKeyIntDesc used to used high to low where key is of type string
func (e ElementsByKeyIntDesc) Len() int
func (e ElementsByKeyIntDesc) Less(i, j int) bool
func (e ElementsByKeyIntDesc) Swap(i, j int)
type ElementsByKeyStringAsc []Element
ElementsByKeyStringAsc used to used low to high where key is of type string
func (e ElementsByKeyStringAsc) Len() int
func (e ElementsByKeyStringAsc) Less(i, j int) bool
func (e ElementsByKeyStringAsc) Swap(i, j int)
type ElementsByKeyStringDesc []Element
ElementsByKeyStringDesc used to used high to low where key is of type string
func (e ElementsByKeyStringDesc) Len() int
func (e ElementsByKeyStringDesc) Less(i, j int) bool
func (e ElementsByKeyStringDesc) Swap(i, j int)
type ElementsByValueIntAsc []Element
ElementsByValueIntAsc used to used low to high where value is of type string
func (e ElementsByValueIntAsc) Len() int
func (e ElementsByValueIntAsc) Less(i, j int) bool
func (e ElementsByValueIntAsc) Swap(i, j int)
type ElementsByValueIntDesc []Element
ElementsByValueIntDesc used to used high to low where value is of type string
func (e ElementsByValueIntDesc) Len() int
func (e ElementsByValueIntDesc) Less(i, j int) bool
func (e ElementsByValueIntDesc) Swap(i, j int)
type ElementsByValueStringAsc []Element
ElementsByValueStringAsc used to used low to high where value is of type string
func (e ElementsByValueStringAsc) Len() int
func (e ElementsByValueStringAsc) Less(i, j int) bool
func (e ElementsByValueStringAsc) Swap(i, j int)
type ElementsByValueStringDesc []Element
ElementsByValueStringDesc used to used high to low where value is of type string
func (e ElementsByValueStringDesc) Len() int
func (e ElementsByValueStringDesc) Less(i, j int) bool
func (e ElementsByValueStringDesc) Swap(i, j int)
type FloatValue32 float32
FloatValue32 type alias for int
func (i FloatValue32) Float32() float32
Float32 casts and returns Float32 value
func (i FloatValue32) Float64() float64
Float64 casts and returns Float64 value
func (i FloatValue32) Int() int
Int casts and returns int value
func (i FloatValue32) Int32() int32
Int32 casts and returns Int32 value
func (i FloatValue32) Int64() int64
Int64 casts and returns Int64 value
func (i FloatValue32) String() string
String casts and returns string value
type FloatValue64 float64
FloatValue64 type alias for int
func (i FloatValue64) Float32() float32
Float32 casts and returns Float32 value
func (i FloatValue64) Float64() float64
Float64 casts and returns Float64 value
func (i FloatValue64) Int() int
Int casts and returns int value
func (i FloatValue64) Int32() int32
Int32 casts and returns Int32 value
func (i FloatValue64) Int64() int64
Int64 casts and returns Int64 value
func (i FloatValue64) String() string
String casts and returns string value
type FloatValues32 []float32
FloatValues32 type alias for a slice of IntValue
func (i FloatValues32) Data() []Data
type FloatValues64 []float32
FloatValues64 type alias for a slice of IntValue
func (i FloatValues64) Data() []Data
type GenericMap map[Data]Data
GenericMap is the default implementation of a map using the Data interface
func NewGenericMap() GenericMap
func (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() []Element
Items returns the internal map as a set of elements
func (i GenericMap) Iterate() <-chan Element
Iterate creates a channel to create an iterator for he Go range statement
func (i GenericMap) Len() int
Len 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() string
String returns the JSON string representation of the map data
type IntValue int
IntValue type alias for int
func (i IntValue) Float32() float32
Float32 casts and returns Float32 value
func (i IntValue) Float64() float64
Float64 casts and returns Float64 value
func (i IntValue) Int() int
Int casts and returns int value
func (i IntValue) Int32() int32
Int32 casts and returns Int32 value
func (i IntValue) Int64() int64
Int64 casts and returns Int64 value
func (i IntValue) String() string
String casts and returns string value
type IntValue32 int32
IntValue32 type alias for int
func (i IntValue32) Float32() float32
Float32 casts and returns Float32 value
func (i IntValue32) Float64() float64
Float64 casts and returns Float64 value
func (i IntValue32) Int() int
Int casts and returns int value
func (i IntValue32) Int32() int32
Int32 casts and returns Int32 value
func (i IntValue32) Int64() int64
Int64 casts and returns Int64 value
func (i IntValue32) String() string
String casts and returns string value
type IntValue64 int64
IntValue64 type alias for int
func (i IntValue64) Float32() float32
Float32 casts and returns Float32 value
func (i IntValue64) Float64() float64
Float64 casts and returns Float64 value
func (i IntValue64) Int() int
Int casts and returns int value
func (i IntValue64) Int32() int32
Int32 casts and returns Int32 value
func (i IntValue64) Int64() int64
Int64 casts and returns Int64 value
func (i IntValue64) String() string
String casts and returns string value
type IntValues []int
IntValues type alias for a slice of IntValue
func (i IntValues) Data() []Data
type IntValues32 []int32
IntValues32 type alias for a slice of IntValue
func (i IntValues32) Data() []Data
type IntValues64 []int64
IntValues64 type alias for a slice of IntValue
func (i IntValues64) Data() []Data
type 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 rune
RuneValue type alias for rune
func (s RuneValue) Float32() float32
Float32 casts and returns Float32 value
func (s RuneValue) Float64() float64
Float64 casts and returns Float64 value
func (s RuneValue) Int() int
Int casts and returns int value
func (s RuneValue) Int32() int32
Int32 casts and returns Int32 value
func (s RuneValue) Int64() int64
Int64 casts and returns Int64 value
func (s RuneValue) String() string
String casts and returns string value
type RuneValues []rune
RuneValues type alias for a slice of RuneValue
func (s RuneValues) Data() []Data
type StringValue string
StringValue type alias for string
func (s StringValue) Float32() float32
Float32 casts and returns Float32 value
func (s StringValue) Float64() float64
Float64 casts and returns Float64 value
func (s StringValue) Int() int
Int casts and returns int value
func (s StringValue) Int32() int32
Int32 casts and returns Int32 value
func (s StringValue) Int64() int64
Int64 casts and returns Int64 value
func (s StringValue) String() string
String casts and returns string value
type StringValues []string
StringValues type alias for a slice of StringValue
func (s StringValues) Data() []Data
type Type int
Type 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) Type
DetermineDataType gets the internal data type converts it to a supported collections type note this does use reflection
Generated by godoc2md