Documentation ¶
Overview ¶
Package kdb implements encoding and decoding of q ipc message format
Index ¶
- Constants
- Variables
- func Compress(b []byte) (dst []byte)
- func Encode(w io.Writer, msgtype int, data *K) error
- func HandleClientConnection(conn net.Conn)
- func NewRuntimeError(msg string) error
- func NewUnsupportedTypeError(msg string) error
- func Uncompress(b []byte) (dst []byte)
- func UnmarshalDict(t Dict, v interface{}) error
- func UnmarshalDictToMap(t Dict, v interface{}) error
- func UnmarshalTable(t Table, v interface{}) (interface{}, error)
- type Attr
- type Dict
- type Function
- type K
- func Bool(x bool) *K
- func BoolV(x []bool) *K
- func Byte(x byte) *K
- func ByteV(x []byte) *K
- func Date(x time.Time) *K
- func DateV(x []time.Time) *K
- func Decode(src *bufio.Reader) (*K, int, error)
- func Enlist(x ...*K) *K
- func Error(x error) *K
- func Float(x float64) *K
- func FloatV(x []float64) *K
- func Int(x int32) *K
- func IntV(x []int32) *K
- func Long(x int64) *K
- func LongV(x []int64) *K
- func NewDict(k, v *K) *K
- func NewFunc(ctx, body string) *K
- func NewTable(cols []string, data ...*K) *K
- func Real(x float32) *K
- func RealV(x []float32) *K
- func Short(x int16) *K
- func ShortV(x []int16) *K
- func String(x string) *K
- func Symbol(x string) *K
- func SymbolV(x []string) *K
- func Time(x time.Time) *K
- func TimeV(x []time.Time) *K
- func Timespan(x time.Duration) *K
- func TimespanV(x []time.Duration) *K
- func Timestamp(x time.Time) *K
- func TimestampV(x []time.Time) *K
- func UUID(x uuid.UUID) *K
- func UUIDV(x []uuid.UUID) *K
- type KDBConn
- func (c *KDBConn) AsyncCall(cmd string, args ...*K) (err error)
- func (c *KDBConn) Call(cmd string, args ...*K) (data *K, err error)
- func (c *KDBConn) CallEx(deadline time.Time, cmd string, args ...*K) (data *K, err error)
- func (c *KDBConn) Close() error
- func (c *KDBConn) ReadMessage() (data *K, msgtype int, e error)
- func (c *KDBConn) Response(data *K) (err error)
- func (c *KDBConn) WriteMessage(msgtype int, data *K) (err error)
- type Minute
- type Month
- type RuntimeError
- type Second
- type Table
- type UnsupportedTypeError
Constants ¶
const ( ASYNC = iota SYNC RESPONSE )
Request type
const ( K0 int8 = 0 // generic type // type bytes qtype ctype accessor KB int8 = 1 // 1 boolean char kG UU int8 = 2 // 16 guid U kU KG int8 = 4 // 1 byte char kG KH int8 = 5 // 2 short short kH KI int8 = 6 // 4 int int kI KJ int8 = 7 // 8 long long kJ KE int8 = 8 // 4 real float kE KF int8 = 9 // 8 float double kF KC int8 = 10 // 1 char char kC KS int8 = 11 // * symbol char* kS KP int8 = 12 // 8 timestamp long kJ (nanoseconds from 2000.01.01) KM int8 = 13 // 4 month int kI (months from 2000.01.01) KD int8 = 14 // 4 date int kI (days from 2000.01.01) KZ int8 = 15 // 8 datetime double kF (DO NOT USE) KN int8 = 16 // 8 timespan long kJ (nanoseconds) KU int8 = 17 // 4 minute int kI KV int8 = 18 // 4 second int kI KT int8 = 19 // 4 time int kI (millisecond) // table,dict XT int8 = 98 // x->k is XD XD int8 = 99 // kK(x)[0] is keys. kK(x)[1] is values. SD int8 = 127 // sorted dict // function types KFUNC int8 = 100 KFUNCUP int8 = 101 // unary primitive KFUNCBP int8 = 102 // binary primitive KFUNCTR int8 = 103 // ternary (operator) KPROJ int8 = 104 // projection KCOMP int8 = 105 // composition KEACH int8 = 106 // f' KOVER int8 = 107 // f/ KSCAN int8 = 108 // f\ KPRIOR int8 = 109 // f': KEACHRIGHT int8 = 110 // f/: KEACHLEFT int8 = 111 // f\: KDYNLOAD int8 = 112 // dynamic load // error type KERR int8 = -128 )
Q type constants
const Nh int16 = math.MinInt16
Short nil
const Ni int32 = math.MinInt32
Int nil
const Nj int64 = math.MinInt64
Long nil
const Wh int16 = math.MaxInt16
Short infinity
const Wi int32 = math.MaxInt32
Int Infinity
const Wj int64 = math.MaxInt64
Long Infinity
Variables ¶
var ErrBadHeader = errors.New("Bad header")
Message header is invalid
var ErrSyncRequest = errors.New("nosyncrequest")
Cannot process sync requests
var Nf float64 = math.NaN()
Double nil
var Wf float64 = math.Inf(1)
Double Infinity
Functions ¶
func NewRuntimeError ¶
NewRuntimeError initializes a new RuntimeError with a message.
func NewUnsupportedTypeError ¶
NewUnsupportedTypeError initializes a new UnsupportedTypeError with a message.
func Uncompress ¶
Ucompress byte array compressed with Q IPC compression
func UnmarshalDictToMap ¶
Unmarshall dict to map[string]{}interface
func UnmarshalTable ¶
Types ¶
type K ¶
K structure
func TimestampV ¶
type KDBConn ¶
KDBConn establishes connection and communicates using Q IPC protocol
func DialKDBEx ¶
func DialKDBEx(host string, port int, auth string, deadline time.Time, tlsCfg *tls.Config) (*KDBConn, error)
Connect to host:port using supplied user:password. Wait timeout for connection
func (*KDBConn) ReadMessage ¶
Read complete message from connection
type RuntimeError ¶
type RuntimeError struct {
// contains filtered or unexported fields
}
RuntimeError is a runtime error thrown by a Q engine
func (*RuntimeError) Error ¶
func (e *RuntimeError) Error() string
type UnsupportedTypeError ¶
type UnsupportedTypeError struct {
// contains filtered or unexported fields
}
UnsupportedTypeError is an error returned when encoding or decoding a type that is not supported by kdb
func (*UnsupportedTypeError) Error ¶
func (e *UnsupportedTypeError) Error() string