Documentation
¶
Index ¶
- Constants
- func Clear(stream string) string
- func Delete(stream, key string) string
- func Drop(stream string) string
- func EncodeFrame(frame LivenFrame) ([]byte, error)
- func Insert(stream, key string, value interface{}) string
- func InsertBatch(stream string, batch [][2]interface{}) string
- func ListStreams() string
- func Status() string
- func Update(stream, key string, value interface{}) string
- func Upsert(stream, key string, value interface{}) string
- func UpsertBatch(stream string, batch [][2]interface{}) string
- type DataValue
- func DVArr(v []DataValue) DataValue
- func DVBin(v []byte) DataValue
- func DVBool(v bool) DataValue
- func DVFlt(v float64) DataValue
- func DVInt(v int64) DataValue
- func DVNull() DataValue
- func DVObj(v map[string]DataValue) DataValue
- func DVStr(v string) DataValue
- func DVUInt(v uint64) DataValue
- func DVVec(v []int8) DataValue
- type FieldFilter
- func (f FieldFilter) Between(low, high float64) FilterExpr
- func (f FieldFilter) Contains(value string) FilterExpr
- func (f FieldFilter) EndsWith(value string) FilterExpr
- func (f FieldFilter) Eq(value interface{}) FilterExpr
- func (f FieldFilter) Gt(value float64) FilterExpr
- func (f FieldFilter) Gte(value float64) FilterExpr
- func (f FieldFilter) In(values []interface{}) FilterExpr
- func (f FieldFilter) Lt(value float64) FilterExpr
- func (f FieldFilter) Lte(value float64) FilterExpr
- func (f FieldFilter) Ne(value interface{}) FilterExpr
- func (f FieldFilter) StartsWith(value string) FilterExpr
- type FilterExpr
- type LivenClient
- func (c *LivenClient) Chain(stream, targetStream, joinKey string) ([]LivenRecord, error)
- func (c *LivenClient) Clear(stream string) ([]LivenRecord, error)
- func (c *LivenClient) Close() error
- func (c *LivenClient) Correlate(stream, sourceStream, joinKey string, withinMs uint64) ([]LivenRecord, error)
- func (c *LivenClient) Count(stream string) ([]LivenRecord, error)
- func (c *LivenClient) Delete(stream, key string) ([]LivenRecord, error)
- func (c *LivenClient) Distinct(stream, field string) ([]LivenRecord, error)
- func (c *LivenClient) DropStream(stream string) ([]LivenRecord, error)
- func (c *LivenClient) Enrich(stream, sourceStream, joinKey string) ([]LivenRecord, error)
- func (c *LivenClient) Filter(stream string, filter FilterExpr) ([]LivenRecord, error)
- func (c *LivenClient) Get(stream, key string) ([]LivenRecord, error)
- func (c *LivenClient) Group(stream, field string, aggregations []string) ([]LivenRecord, error)
- func (c *LivenClient) Insert(stream, key string, value interface{}) ([]LivenRecord, error)
- func (c *LivenClient) InsertMany(stream string, batch [][2]interface{}) ([]LivenRecord, error)
- func (c *LivenClient) Limit(stream string, count int) ([]LivenRecord, error)
- func (c *LivenClient) Map(stream string, fields []string) ([]LivenRecord, error)
- func (c *LivenClient) Page(stream string, pageNum, pageSize int) ([]LivenRecord, error)
- func (c *LivenClient) PageCursor(stream, cursor string, pageSize int) ([]LivenRecord, error)
- func (c *LivenClient) Query(dsl string) ([]LivenRecord, error)
- func (c *LivenClient) Run(pipeline *Pipeline) ([]LivenRecord, error)
- func (c *LivenClient) RunDelete(pipeline *Pipeline) ([]LivenRecord, error)
- func (c *LivenClient) RunListen(pipeline *Pipeline) ([]LivenRecord, error)
- func (c *LivenClient) RunUpdate(pipeline *Pipeline, value interface{}) ([]LivenRecord, error)
- func (c *LivenClient) Sequence(stream string, steps []FilterExpr, withinMs uint64) ([]LivenRecord, error)
- func (c *LivenClient) Sort(stream, field string, descending bool) ([]LivenRecord, error)
- func (c *LivenClient) Status() ([]LivenRecord, error)
- func (c *LivenClient) Streams() ([]LivenRecord, error)
- func (c *LivenClient) Update(stream, key string, value interface{}) ([]LivenRecord, error)
- func (c *LivenClient) Upsert(stream, key string, value interface{}) ([]LivenRecord, error)
- func (c *LivenClient) UpsertMany(stream string, batch [][2]interface{}) ([]LivenRecord, error)
- func (c *LivenClient) VectorFilter(stream, field string, queryVector []int8, threshold float64) ([]LivenRecord, error)
- func (c *LivenClient) Window(stream string, durationMs uint64, strategy string) ([]LivenRecord, error)
- type LivenFrame
- type LivenRecord
- type Pipeline
- func (p *Pipeline) Build() string
- func (p *Pipeline) BuildDelete() string
- func (p *Pipeline) BuildListen() string
- func (p *Pipeline) BuildUpdate(value interface{}) string
- func (p *Pipeline) Chain(targetStream, joinKey string) *Pipeline
- func (p *Pipeline) Correlate(sourceStream, joinKey string, withinMs uint64) *Pipeline
- func (p *Pipeline) Count() *Pipeline
- func (p *Pipeline) Distinct(field string) *Pipeline
- func (p *Pipeline) Enrich(sourceStream, joinKey string) *Pipeline
- func (p *Pipeline) Filter(f FilterExpr) *Pipeline
- func (p *Pipeline) Get(key string) *Pipeline
- func (p *Pipeline) Group(field string, aggregations []string) *Pipeline
- func (p *Pipeline) Limit(count int) *Pipeline
- func (p *Pipeline) Map(fields []string) *Pipeline
- func (p *Pipeline) Page(pageNum, pageSize int) *Pipeline
- func (p *Pipeline) PageCursor(cursor string, pageSize int) *Pipeline
- func (p *Pipeline) Sequence(steps []FilterExpr, withinMs uint64) *Pipeline
- func (p *Pipeline) Sort(field string, descending bool) *Pipeline
- func (p *Pipeline) VectorFilter(field string, queryVector []int8, threshold float64) *Pipeline
- func (p *Pipeline) Window(durationMs uint64, strategy string) *Pipeline
Constants ¶
View Source
const ( ProtocolVersion = 0x01 DiscriminatorMsgpack = 0x02 DiscriminatorVector = 0x03 HeaderSize = 5 )
Wire protocol constants.
Variables ¶
This section is empty.
Functions ¶
func EncodeFrame ¶
func EncodeFrame(frame LivenFrame) ([]byte, error)
EncodeFrame encodes a LivenFrame into a framed byte buffer.
func InsertBatch ¶
func ListStreams ¶
func ListStreams() string
func UpsertBatch ¶
Types ¶
type DataValue ¶
type DataValue struct {
Type string `msgpack:"-" json:"type"`
Value interface{} `msgpack:"-" json:"value,omitempty"`
}
type FieldFilter ¶
type FieldFilter struct {
// contains filtered or unexported fields
}
FieldFilter is an intermediate builder returned by FilterField.
func FilterField ¶
func FilterField(name string) FieldFilter
func (FieldFilter) Between ¶
func (f FieldFilter) Between(low, high float64) FilterExpr
func (FieldFilter) Contains ¶
func (f FieldFilter) Contains(value string) FilterExpr
func (FieldFilter) EndsWith ¶
func (f FieldFilter) EndsWith(value string) FilterExpr
func (FieldFilter) Eq ¶
func (f FieldFilter) Eq(value interface{}) FilterExpr
func (FieldFilter) Gt ¶
func (f FieldFilter) Gt(value float64) FilterExpr
func (FieldFilter) Gte ¶
func (f FieldFilter) Gte(value float64) FilterExpr
func (FieldFilter) In ¶
func (f FieldFilter) In(values []interface{}) FilterExpr
func (FieldFilter) Lt ¶
func (f FieldFilter) Lt(value float64) FilterExpr
func (FieldFilter) Lte ¶
func (f FieldFilter) Lte(value float64) FilterExpr
func (FieldFilter) Ne ¶
func (f FieldFilter) Ne(value interface{}) FilterExpr
func (FieldFilter) StartsWith ¶
func (f FieldFilter) StartsWith(value string) FilterExpr
type FilterExpr ¶
type FilterExpr struct {
Kind string `msgpack:"kind"`
Field string `msgpack:"field,omitempty"`
Operator string `msgpack:"operator,omitempty"`
Value interface{} `msgpack:"value,omitempty"`
Left *FilterExpr `msgpack:"left,omitempty"`
Right *FilterExpr `msgpack:"right,omitempty"`
Expr *FilterExpr `msgpack:"expr,omitempty"`
}
func FilterAnd ¶
func FilterAnd(filters ...FilterExpr) FilterExpr
func FilterNot ¶
func FilterNot(filter FilterExpr) FilterExpr
func FilterOr ¶
func FilterOr(filters ...FilterExpr) FilterExpr
type LivenClient ¶
type LivenClient struct {
// contains filtered or unexported fields
}
LivenClient is a native wire protocol client for LivenDB.
Usage:
client, err := liven.Connect("127.0.0.1:43121")
if err != nil { ... }
defer client.Close()
client.Insert("users", "u1", map[string]interface{}{"name": "Alice"})
records, _ := client.Get("users", "u1")
func Connect ¶
func Connect(addr string) (*LivenClient, error)
Connect connects to a Liven server over TCP. Supports optional auth_key via URL query: "host:port?auth_key=xxx"
func (*LivenClient) Chain ¶
func (c *LivenClient) Chain(stream, targetStream, joinKey string) ([]LivenRecord, error)
func (*LivenClient) Clear ¶
func (c *LivenClient) Clear(stream string) ([]LivenRecord, error)
func (*LivenClient) Correlate ¶
func (c *LivenClient) Correlate(stream, sourceStream, joinKey string, withinMs uint64) ([]LivenRecord, error)
func (*LivenClient) Count ¶
func (c *LivenClient) Count(stream string) ([]LivenRecord, error)
func (*LivenClient) Delete ¶
func (c *LivenClient) Delete(stream, key string) ([]LivenRecord, error)
func (*LivenClient) Distinct ¶
func (c *LivenClient) Distinct(stream, field string) ([]LivenRecord, error)
func (*LivenClient) DropStream ¶
func (c *LivenClient) DropStream(stream string) ([]LivenRecord, error)
func (*LivenClient) Enrich ¶
func (c *LivenClient) Enrich(stream, sourceStream, joinKey string) ([]LivenRecord, error)
func (*LivenClient) Filter ¶
func (c *LivenClient) Filter(stream string, filter FilterExpr) ([]LivenRecord, error)
func (*LivenClient) Get ¶
func (c *LivenClient) Get(stream, key string) ([]LivenRecord, error)
func (*LivenClient) Group ¶
func (c *LivenClient) Group(stream, field string, aggregations []string) ([]LivenRecord, error)
func (*LivenClient) Insert ¶
func (c *LivenClient) Insert(stream, key string, value interface{}) ([]LivenRecord, error)
func (*LivenClient) InsertMany ¶
func (c *LivenClient) InsertMany(stream string, batch [][2]interface{}) ([]LivenRecord, error)
func (*LivenClient) Limit ¶
func (c *LivenClient) Limit(stream string, count int) ([]LivenRecord, error)
func (*LivenClient) Map ¶
func (c *LivenClient) Map(stream string, fields []string) ([]LivenRecord, error)
func (*LivenClient) Page ¶
func (c *LivenClient) Page(stream string, pageNum, pageSize int) ([]LivenRecord, error)
func (*LivenClient) PageCursor ¶
func (c *LivenClient) PageCursor(stream, cursor string, pageSize int) ([]LivenRecord, error)
func (*LivenClient) Query ¶
func (c *LivenClient) Query(dsl string) ([]LivenRecord, error)
Query sends a raw LIVEN DSL string and returns parsed records.
func (*LivenClient) Run ¶
func (c *LivenClient) Run(pipeline *Pipeline) ([]LivenRecord, error)
func (*LivenClient) RunDelete ¶
func (c *LivenClient) RunDelete(pipeline *Pipeline) ([]LivenRecord, error)
func (*LivenClient) RunListen ¶
func (c *LivenClient) RunListen(pipeline *Pipeline) ([]LivenRecord, error)
func (*LivenClient) RunUpdate ¶
func (c *LivenClient) RunUpdate(pipeline *Pipeline, value interface{}) ([]LivenRecord, error)
func (*LivenClient) Sequence ¶
func (c *LivenClient) Sequence(stream string, steps []FilterExpr, withinMs uint64) ([]LivenRecord, error)
func (*LivenClient) Sort ¶
func (c *LivenClient) Sort(stream, field string, descending bool) ([]LivenRecord, error)
func (*LivenClient) Status ¶
func (c *LivenClient) Status() ([]LivenRecord, error)
func (*LivenClient) Streams ¶
func (c *LivenClient) Streams() ([]LivenRecord, error)
func (*LivenClient) Update ¶
func (c *LivenClient) Update(stream, key string, value interface{}) ([]LivenRecord, error)
func (*LivenClient) Upsert ¶
func (c *LivenClient) Upsert(stream, key string, value interface{}) ([]LivenRecord, error)
func (*LivenClient) UpsertMany ¶
func (c *LivenClient) UpsertMany(stream string, batch [][2]interface{}) ([]LivenRecord, error)
func (*LivenClient) VectorFilter ¶
func (c *LivenClient) VectorFilter(stream, field string, queryVector []int8, threshold float64) ([]LivenRecord, error)
func (*LivenClient) Window ¶
func (c *LivenClient) Window(stream string, durationMs uint64, strategy string) ([]LivenRecord, error)
type LivenFrame ¶
type LivenFrame struct {
Type string `msgpack:"-" json:"type"`
Query string `msgpack:"-" json:"query,omitempty"`
Records []LivenRecord `msgpack:"-" json:"records,omitempty"`
ClientID string `msgpack:"-" json:"client_id,omitempty"`
ProtocolVersion *uint8 `msgpack:"-" json:"protocol_version,omitempty"`
Message string `msgpack:"-" json:"message,omitempty"`
Values []int8 `msgpack:"-" json:"values,omitempty"`
}
type LivenRecord ¶
type LivenRecord struct {
SequenceID uint64 `msgpack:"-" json:"sequence_id"`
Timestamp int64 `msgpack:"-" json:"timestamp"`
TypeTag uint8 `msgpack:"-" json:"type_tag"`
Flags uint8 `msgpack:"-" json:"flags"`
StreamName string `msgpack:"-" json:"stream_name"`
Key string `msgpack:"-" json:"key"`
Value DataValue `msgpack:"-" json:"value"`
}
func (LivenRecord) String ¶
func (r LivenRecord) String() string
type Pipeline ¶
type Pipeline struct {
// contains filtered or unexported fields
}
func NewPipeline ¶
func (*Pipeline) BuildDelete ¶
func (*Pipeline) BuildListen ¶
func (*Pipeline) BuildUpdate ¶
func (*Pipeline) Filter ¶
func (p *Pipeline) Filter(f FilterExpr) *Pipeline
func (*Pipeline) Sequence ¶
func (p *Pipeline) Sequence(steps []FilterExpr, withinMs uint64) *Pipeline
func (*Pipeline) VectorFilter ¶
Click to show internal directories.
Click to hide internal directories.