api

package
v0.0.0-...-8113b3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 4, 2025 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RowDataToBlob

func RowDataToBlob(rd *Row) []byte

Types

type BinaryExpr

type BinaryExpr struct {
	Operator    string
	Left, Right Value
}

func (*BinaryExpr) Cast

func (e *BinaryExpr) Cast(target Type) Value

func (*BinaryExpr) Equals

func (e *BinaryExpr) Equals(other Value) bool

func (*BinaryExpr) GetType

func (e *BinaryExpr) GetType() Type

type BooleanValue

type BooleanValue struct {
	Value bool
}
var (
	True  BooleanValue = BooleanValue{true}
	False              = BooleanValue{false}
)

func (BooleanValue) Cast

func (b BooleanValue) Cast(target Type) Value

func (BooleanValue) Equals

func (b BooleanValue) Equals(other Value) bool

func (BooleanValue) GetType

func (b BooleanValue) GetType() Type

type Evaluation

type Evaluation struct {
	Reads  []Value
	Filter Value

	// this is probably quite hard to pull off.
	Joins []any
}

type Evaluator

type Evaluator struct{}

func (*Evaluator) Eval

func (q *Evaluator) Eval(query string) *Evaluation

type FloatValue

type FloatValue struct {
	Value float64
}

func (FloatValue) Cast

func (i FloatValue) Cast(target Type) Value

func (*FloatValue) Equals

func (v *FloatValue) Equals(other Value) bool

func (FloatValue) GetType

func (i FloatValue) GetType() Type

type Function

type Function struct {
	Name   string
	Params []Value
}

func NewFunction

func NewFunction(name string, params []Value) *Function

func (*Function) Cast

func (f *Function) Cast(Type) Value

func (*Function) Equals

func (v *Function) Equals(other Value) bool

func (*Function) GetType

func (f *Function) GetType() Type

type IntegerValue

type IntegerValue struct {
	Value int64
}

func (*IntegerValue) Cast

func (i *IntegerValue) Cast(target Type) Value

func (*IntegerValue) Equals

func (v *IntegerValue) Equals(other Value) bool

func (IntegerValue) GetType

func (i IntegerValue) GetType() Type

type JqMessageParser

type JqMessageParser struct {
	// contains filtered or unexported fields
}

func (*JqMessageParser) Process

func (j *JqMessageParser) Process(p *Pipeline, in, out RowSchema, msg model.Message) (model.Message, error)

type JqParserParams

type JqParserParams struct {
	// contains filtered or unexported fields
}

func NewJqParams

func NewJqParams(queries map[string]string) JqParserParams

type JsonEncoder

type JsonEncoder struct{}

func NewJsonEncoder

func NewJsonEncoder() *JsonEncoder

func (*JsonEncoder) Process

func (j *JsonEncoder) Process(p *Pipeline, _, _ RowSchema, msg model.Message) (model.Message, error)

type Pipeline

type Pipeline struct {
	Input       []Source
	Processors  []PipelineStep
	Output      Sink
	SideOutput  Sink
	Parallelism int
}

func (Pipeline) Start

func (p Pipeline) Start()

type PipelineStep

type PipelineStep struct {
	Name   string
	Proc   Processor
	Schema RowSchema
}

func NewPipelineStep

func NewPipelineStep(name string, proc Processor, schema RowSchema) PipelineStep

type Printer

type Printer struct {
	// contains filtered or unexported fields
}

Printer will write to stdout

func NewPrinter

func NewPrinter() *Printer

func (*Printer) Write

func (p *Printer) Write(blob []byte) error

type Processor

type Processor interface {
	Process(p *Pipeline, in, out RowSchema, msg model.Message) (model.Message, error)
}

func NewJqMessageParser

func NewJqMessageParser(p JqParserParams) Processor

type Query

type Query struct {
	// contains filtered or unexported fields
}

Query represents an ANSI(?) SQL statement

func NewQuery

func NewQuery(query string) *Query

func (*Query) GetEvaluation

func (q *Query) GetEvaluation() *Evaluation

func (*Query) Process

func (q *Query) Process(p *Pipeline, in, out RowSchema, msg model.Message) (model.Message, error)

type Row

type Row struct {
	Values []Value
}

func RowDataFromBlob

func RowDataFromBlob(blob []byte) (*Row, error)

func (*Row) GetColumn

func (r *Row) GetColumn(col int) Value

func (*Row) SetColumn

func (r *Row) SetColumn(idx int, val Value)

type RowIdentifier

type RowIdentifier struct {
	Name string
}

func NewRowIdentifier

func NewRowIdentifier(name string) *RowIdentifier

func (RowIdentifier) Cast

func (i RowIdentifier) Cast(target Type) Value

func (*RowIdentifier) Equals

func (v *RowIdentifier) Equals(other Value) bool

func (RowIdentifier) GetType

func (i RowIdentifier) GetType() Type

func (*RowIdentifier) String

func (r *RowIdentifier) String() string

type RowSchema

type RowSchema struct {
	Column []string
	Types  []Type
}

func (RowSchema) ColIndex

func (s RowSchema) ColIndex(name string) int

func (RowSchema) String

func (s RowSchema) String() string

type Sink

type Sink interface {
	Write([]byte) error
}

type Source

type Source interface {
	// Read consumes from the input source
	Read() ([]byte, error)
}

type StringValue

type StringValue struct {
	Value string
}

func (*StringValue) Cast

func (i *StringValue) Cast(target Type) Value

func (*StringValue) Equals

func (v *StringValue) Equals(other Value) bool

func (StringValue) GetType

func (i StringValue) GetType() Type

type Type

type Type int
const (
	TypeUnspecified Type = iota
	TypeString
	TypeInteger
	TypeFloat
	TypeBoolean
)

type Value

type Value interface {
	Cast(target Type) Value
	GetType() Type
	Equals(other Value) bool
}

func ValueFromType

func ValueFromType(s Type, value string) Value

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址