Documentation
¶
Index ¶
- func ProjectionFields(fields []string) [][]string
- func Sort(sortKeys []string, reverseList []bool, data []Record)
- type Record
- func (r Record) Flatten() map[string]interface{}
- func (r Record) Get(nameParts []string) (interface{}, bool)
- func (r Record) Pop(nameParts []string) (interface{}, bool)
- func (r Record) Project(projectionFields [][]string) Record
- func (r Record) Remove(nameParts []string) bool
- func (r Record) Set(nameParts []string, newValue interface{}) bool
- type RecordHeap
- type RecordItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProjectionFields ¶
Types ¶
type Record ¶
type Record map[string]interface{}
func (Record) Pop ¶
Pop will pop an item at `nameParts` and return the value and a boolean on whether it was successful (similar to map accessing)
type RecordHeap ¶
type RecordHeap struct { Heap []RecordItem // contains filtered or unexported fields }
RecordHeap is a heap for use in sorting Record objects Records need "special" sorting as we potentially have many fields to sort by, so we effectively need to sort by each key until one has a comparison that sorts -- otherwise we continue down the list of sortKeys until we find one or we hit the end. In addition to the sort we also need to support "reverse" but we need the heap to still work with pop/push. To make this work we just have a reverseList option per sortKey, and the underlying sort list will negate the Less() return if "reverse" is true
func NewRecordHeap ¶
func NewRecordHeap(splitSortKeys [][]string, reverseList []bool) *RecordHeap
func (RecordHeap) Len ¶
func (r RecordHeap) Len() int
func (RecordHeap) Less ¶
func (r RecordHeap) Less(i, j int) (l bool)
func (*RecordHeap) Pop ¶
func (r *RecordHeap) Pop() interface{}
func (*RecordHeap) PopDirect ¶
func (r *RecordHeap) PopDirect() RecordItem
func (*RecordHeap) Push ¶
func (r *RecordHeap) Push(x interface{})
func (*RecordHeap) PushDirect ¶
func (r *RecordHeap) PushDirect(x RecordItem)
func (RecordHeap) Swap ¶
func (r RecordHeap) Swap(i, j int)