Documentation ¶
Index ¶
- Constants
- Variables
- func AbsPath(filename string) string
- func AnalyzeFile(filename string)
- func EstimateRecordCount(filename string) (int, error)
- func EvaluateFields(filename string) (int, error)
- func Exists(filename string) bool
- func FMe[T Number](b []byte, num T) error
- func FetchByte(b []byte) (interface{}, error)
- func FetchF1(b []byte) (interface{}, error)
- func FetchF16(b []byte) (interface{}, error)
- func FetchF32(b []byte) (interface{}, error)
- func FetchF64(b []byte) (interface{}, error)
- func FetchI16(b []byte) (interface{}, error)
- func FetchI32(b []byte) (interface{}, error)
- func FetchI64(b []byte) (interface{}, error)
- func FileSize(filename string) (int64, error)
- func FileWriter(filename string, bufSize int) (io.WriteCloser, error)
- func GobDump(filename string, obj interface{}) error
- func GobLoad(filename string, obj interface{}) error
- func JDump(obj interface{})
- func LineCount(filename string) (int, error)
- func LineReader(r io.Reader, fn func(string) error) error
- func LoadCSV(filename string, fn func([]string) error) error
- func LoadCSVHeaders(filename string, skip int, fn func([]string) error) error
- func LoadLines(filename string, fn func(string) error) error
- func MagicHead() [4]byte
- func NewFileReader(filename string) (io.ReadCloser, error)
- func RoundUp(n int) int
- func SerialByte(b []byte, x interface{}) error
- func Serialized[T ~int | ~float64](b []byte, x interface{}) error
- type AColumn
- type CSVWriter
- type Column
- type ColumnKey
- type Columnar
- type DataType
- type Decipher
- type Encipher
- type F16
- type F32
- type F64
- type FP1
- type FWriter
- type FileBuf
- type FileInfo
- type FileReader
- type Handler
- type HeadFlag
- type Holder
- type HolderHeader
- type HoldsByte
- type HoldsF16
- type HoldsI32
- type HoldsI64
- type HoldsText
- type Kind
- type LineStats
- type LiveHeader
- type NX32
- type NX64
- type Number
- type Odds
- type RecFun
- type RecMux
- type Record
- type RecordHolder
- type Recorder
- type Runner
- type Size
- type Unknown
- type What
Constants ¶
const F16_max = math.MaxUint16 / f16Mul
const F32_max = math.MaxFloat32
const F64_max = math.MaxFloat64
const HolderHeaderSize = int(unsafe.Sizeof(HolderHeader{}))
const MaxKeyCount = 65535
const NX32_max = math.MaxInt32
const NX64_max = math.MaxInt64
Variables ¶
var ( ErrTooSmall = errors.New("buffer is too small") ErrExceeds = errors.New("value exceeds max size") )
var ErrKeyOverload = fmt.Errorf("key cardinality exceeeds max size")
var ErrNotFound = errors.New("not found")
Functions ¶
func AnalyzeFile ¶
func AnalyzeFile(filename string)
func EstimateRecordCount ¶
EstimateRecordCount samples the file to estimate how many lines
func EvaluateFields ¶
EvaluateFields establishs what type the columns represent
func FileWriter ¶
func FileWriter(filename string, bufSize int) (io.WriteCloser, error)
FileWriter creates in io.WriteCloser that buffers and optionally compresses the output
func MagicHead ¶
func MagicHead() [4]byte
MagicHead is the 4 byte header prefix to identify the file type
func NewFileReader ¶
func NewFileReader(filename string) (io.ReadCloser, error)
func SerialByte ¶
SerialByte writes the value of x into a byte in b
Types ¶
type Decipher ¶
func FetchString ¶
type F16 ¶
type F16 uint16
F16 allows up to 2 decimal places on a number < 655 (as we pack) it times 100 as an int NOTE: the number is expected to be *positive*
func (*F16) FromFloat64 ¶
type FP1 ¶
type FP1 uint16
FP1 allows up to 2 decimal places on a positive number < 655 Storage is 2 bytes
func (FP1) MarshalJSON ¶
type FileInfo ¶
type FileReader ¶
type FileReader struct {
// contains filtered or unexported fields
}
func (FileReader) Close ¶
func (br FileReader) Close() error
type Holder ¶
type Holder struct { RecordWidth int // binary record width Columns []string // contains filtered or unexported fields }
Holder manages a binary packed table layout on disk is ordered to do word alignment if possible
func NewHolder ¶
NewHolder takes columns with optional formatting/range info columnName:maxSize:precision if precision == "s" the field is a fixed with string of maxSize width
func (Holder) MakeEncoder ¶
func (*Holder) NewRecord ¶
func (h *Holder) NewRecord() *RecordHolder
type HolderHeader ¶
func (*HolderHeader) Decode ¶
func (hh *HolderHeader) Decode(b []byte) error
func (HolderHeader) Encode ¶
func (hh HolderHeader) Encode(b []byte) error
func (fp *FireJulySrc) Encode(buf []byte) error { if len(buf) < fp.Size() { log.Printf("buffer size: %d -- we need: %d", len(buf), fp.Size()) return io.EOF } const off = 4 idx := 0 binary.LittleEndian.PutUint32(buf[idx:], math.Float32bits(float32(fp.Lat))) idx += 4 binary.LittleEndian.PutUint32(buf[idx:], math.Float32bits(float32(fp.Lon))) idx += 4 binary.LittleEndian.PutUint32(buf[idx:], fp.Score)
func (HolderHeader) Equal ¶
func (hh HolderHeader) Equal(x HolderHeader) error
type LiveHeader ¶
type LiveHeader struct { Head HolderHeader Columns []Column }
func MakeHeader ¶
func MakeHeader(columns ...Column) LiveHeader
func ReadHeader ¶
func ReadHeader(r io.Reader) (*LiveHeader, error)
type Number ¶
type Number interface { constraints.Integer | constraints.Float }
type Odds ¶
type Odds uint16
Odds represents a number between 0.0 and 1.0 with accuracy of 4 decimal places It is able to do so in 2 bytes, for compactness
func (*Odds) MarshalBinary ¶
func (*Odds) MarshalJSON ¶
type RecFun ¶
type RecFun func() Record
var _ Record = (*HoldsF16)(nil) //.Record() var _ MyInterface = (*MyType)(nil)
type RecordHolder ¶
type RecordHolder struct {
// contains filtered or unexported fields
}
func (*RecordHolder) Decode ¶
func (rh *RecordHolder) Decode(b []byte) error
Decode converts a byte slice to a record
func (RecordHolder) MarshalJSON ¶
func (rh RecordHolder) MarshalJSON() ([]byte, error)