Documentation ¶
Overview ¶
Package dac implements a compressed dictionary for booleans, integers, dates, and floats of all sizes. Compression is obtained by application of variable byte codes. Direct access to any value is obtained through the utilization of Directly Addressable Codes (DACs). The integer data can be searched efficiently when sorted.
Index ¶
- func Len(d *Dict) int
- type Dict
- func (d *Dict) Close()
- func (d *Dict) InsertU64At(k int, v uint64) error
- func (d *Dict) Iter() Iterator
- func (d *Dict) ReadBool(i int) (bool, error)
- func (d *Dict) ReadBoolList(values []bool) []bool
- func (d *Dict) ReadDateTime(i int) (time.Time, error)
- func (d *Dict) ReadDateTimeList(dateTimes []time.Time) []time.Time
- func (d *Dict) ReadFloat32(i int) (float32, error)
- func (d *Dict) ReadFloat32List(values []float32) []float32
- func (d *Dict) ReadFloat64(i int) (float64, error)
- func (d *Dict) ReadFloat64List(values []float64) []float64
- func (d *Dict) ReadI16(i int) (int16, error)
- func (d *Dict) ReadI16List(values []int16) []int16
- func (d *Dict) ReadI32(i int) (int32, error)
- func (d *Dict) ReadI32List(values []int32) []int32
- func (d *Dict) ReadI64(i int) (int64, error)
- func (d *Dict) ReadI64List(values []int64) []int64
- func (d *Dict) ReadI8(i int) (int8, error)
- func (d *Dict) ReadI8List(values []int8) []int8
- func (d *Dict) ReadU16(k int) (v uint16, err error)
- func (d *Dict) ReadU16List(values []uint16) []uint16
- func (d *Dict) ReadU32(k int) (v uint32, err error)
- func (d *Dict) ReadU32List(values []uint32) []uint32
- func (d *Dict) ReadU64(k int) (v uint64, err error)
- func (d *Dict) ReadU64List(values []uint64) []uint64
- func (d *Dict) ReadU8(i int) (uint8, error)
- func (d *Dict) ReadU8List(values []uint8) []uint8
- func (d *Dict) RemoveAt(k int) error
- func (d *Dict) Reset()
- func (d *Dict) Scan(value uint64) (idx int)
- func (d *Dict) Search(value uint64) (idx, l int)
- func (d *Dict) UpdateU64At(k int, v uint64) error
- func (d *Dict) WriteBool(v bool) int
- func (d *Dict) WriteBoolList(values []bool)
- func (d *Dict) WriteDateTime(t time.Time) int
- func (d *Dict) WriteDateTimeList(dateTimes []time.Time)
- func (d *Dict) WriteFloat32(v float32) int
- func (d *Dict) WriteFloat32List(values []float32)
- func (d *Dict) WriteFloat64(v float64) int
- func (d *Dict) WriteFloat64List(values []float64)
- func (d *Dict) WriteI16(v int16) int
- func (d *Dict) WriteI16List(values []int16)
- func (d *Dict) WriteI32(v int32) int
- func (d *Dict) WriteI32List(values []int32)
- func (d *Dict) WriteI64(v int64) int
- func (d *Dict) WriteI64List(values []int64)
- func (d *Dict) WriteI8(v int8) int
- func (d *Dict) WriteI8List(values []int8)
- func (d *Dict) WriteU16(v uint16) int
- func (d *Dict) WriteU16List(values []uint16)
- func (d *Dict) WriteU32(v uint32) int
- func (d *Dict) WriteU32List(values []uint32)
- func (d *Dict) WriteU64(v uint64) int
- func (d *Dict) WriteU64List(values []uint64)
- func (d *Dict) WriteU8(v uint8) int
- func (d *Dict) WriteU8List(values []uint8)
- type Iterator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dict ¶
type Dict struct {
// contains filtered or unexported fields
}
Dict is a dictionary type that stores values in a "Directly Addressable Codes" structure. Data is compressed but still provides direct access to any value. Moreover, data can be searched efficiently when stored in sorted order.
func From ¶
From constructs a dictionary from the given values. From automatically closes the dictionary for writing.
func New ¶
New constructs a dictionary with an initial capacity of n values. Setting the capacity is optional but recommended for performance reasons. The capacity gets automatically updated when needed.
func (*Dict) Close ¶
func (d *Dict) Close()
Close builds support structures that improve the performance of direct reads. You should not do any direct reads before calling Close, as the read will crash. You can still write to the dictionary after a call to Close, but you will have to close the dictionary again before doing any direct reads.
func (*Dict) InsertU64At ¶
InsertU64At inserts a uint64 value at index k of the dictionary.
func (*Dict) ReadBoolList ¶
ReadBoolList returns all values in the dictionary when they are of boolean type. One can avoid the allocation of the return slice in ReadBoolList by supplying a slice of a size sufficient to store all values. Supplying a slice is optional.
func (*Dict) ReadDateTime ¶
ReadDateTime reads a time.Time value at a given index in the dictionary. No timezone is read.
func (*Dict) ReadDateTimeList ¶
ReadDateTimeList returns all values in the dictionary when they are of time.Time type. One can avoid the allocation of the return slice in ReadDateTimeList by supplying a slice of a size sufficient to store all values. However, this is optional.
func (*Dict) ReadFloat32 ¶
ReadFloat32 reads a float32 value at a given index in the dictionary.
func (*Dict) ReadFloat32List ¶
ReadFloat32List returns all values in the dictionary when they are of float32 type. One can avoid the allocation of the return slice in ReadFloat32List by supplying a slice of a size sufficient to store all values. However, this is optional.
func (*Dict) ReadFloat64 ¶
ReadFloat64 reads a float64 value at a given index in the dictionary.
func (*Dict) ReadFloat64List ¶
ReadFloat64List returns all values in the dictionary when they are of float64 type. One can avoid the allocation of the return slice in ReadFloat64List by supplying a slice of a size sufficient to store all values. However, this is optional.
func (*Dict) ReadI16List ¶
ReadI16List returns all values in the dictionary when they are of int16 type. One can avoid the allocation of the return slice in ReadI16List by supplying a slice of a size sufficient to store all values. Still, this is optional.
func (*Dict) ReadI32List ¶
ReadI32List returns all values in the dictionary when they are of int32 type. One can avoid the allocation of the return slice in ReadI32List by supplying a slice of a size sufficient to store all values. Still, this is optional.
func (*Dict) ReadI64List ¶
ReadI64List returns all values in the dictionary when they are of int64 type. One can avoid the allocation of the return slice in ReadI64List by supplying a slice of a size sufficient to store all values. Still, this is optional.
func (*Dict) ReadI8List ¶
ReadI8List returns all values in the dictionary when they are of int8 type. One can avoid the allocation of the return slice in ReadI8List by supplying a slice of a size sufficient to store all values. Still, this is optional.
func (*Dict) ReadU16List ¶
ReadU16List returns all values in the dictionary when they are of uint16 type. One can avoid the allocation of the return slice in ReadU16List by supplying a slice of a size sufficient to store all values. Supplying a slice is optional.
func (*Dict) ReadU32List ¶
ReadU32List returns all values in the dictionary when they are of uint32 type. One can avoid the allocation of the return slice in ReadU32List by supplying a slice of a size sufficient to store all values. Supplying a slice is optional.
func (*Dict) ReadU64List ¶
ReadU64List returns all values in the dictionary when they are of uint64 type. One can avoid the allocation of the return slice in ReadU64List by supplying a slice of a size sufficient to store all values. Supplying a slice is optional.
func (*Dict) ReadU8List ¶
ReadU8List returns all values in the dictionary when they are of uint8 type. One can avoid the allocation of the return slice in ReadU8List by supplying a slice of a size sufficient to store all values. Supplying a slice is optional.
func (*Dict) Reset ¶
func (d *Dict) Reset()
Reset resets the dictionary without releasing its resources. It allows to re-use an existing dictionary.
func (*Dict) Scan ¶
Scan returns the index of the first instance of the search value in the dictionary. If the value is not found, -1 is returned. When the values are sorted, Search is going to be faster than Scan.
func (*Dict) Search ¶
Search returns the indexes in the dictionary of the searched value. If value is not found, an empty slice is returned. Search should only be used when the dictionary is sorted.
func (*Dict) UpdateU64At ¶
UpdateU64At updates a uint64 value at index k of the dictionary.
func (*Dict) WriteBoolList ¶
WriteBoolList writes a slice of boolean values to the dictionary.
func (*Dict) WriteDateTime ¶
WriteDateTime writes a time.Time value with nanosecond precision to the dictionary. Timezones are not written.
func (*Dict) WriteDateTimeList ¶
WriteDateTimeList writes a slice of time.Time values to the dictionary.
func (*Dict) WriteFloat32 ¶
WriteFloat32 writes a float32 value to the dictionary.
func (*Dict) WriteFloat32List ¶
WriteFloat32List writes a slice of float values to the dictionary.
func (*Dict) WriteFloat64 ¶
WriteFloat64 writes a float64 value to the dictionary.
func (*Dict) WriteFloat64List ¶
WriteFloat64List writes a slice of float64 values to the dictionary.
func (*Dict) WriteI16List ¶
WriteI16List writes a slice of int16 values to the dictionary.
func (*Dict) WriteI32List ¶
WriteI32List writes a slice of int32 values to the dictionary.
func (*Dict) WriteI64List ¶
WriteI64List writes a slice of int64 values to the dictionary.
func (*Dict) WriteI8List ¶
WriteI8List writes a slice of int8 values to the dictionary.
func (*Dict) WriteU16List ¶
WriteU16List writes a slice of uint16 values to the dictionary.
func (*Dict) WriteU32List ¶
WriteU32List writes a slice of uint32 values to the dictionary.
func (*Dict) WriteU64 ¶
WriteU64 writes a uint64 value at the end of the dictionary. A write index is returned.
func (*Dict) WriteU64List ¶
WriteU64List writes a slice of uint64 values to the dictionary.
func (*Dict) WriteU8List ¶
WriteU8List writes a slice of uint8 values to the dictionary.
type Iterator ¶
type Iterator struct {
// contains filtered or unexported fields
}
Iterator enables iteration over the dictionary. Concurrent iteration is allowed once the dictionary is closed (no more writing).
func (*Iterator) Next ¶
Next returns the next index and value from the dictionary. If there is not a next value, the ok return value will be false.