types

package
v0.0.0-...-e3452d7 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InnerJoin = JoinType(iota)
	LeftJoin
	OuterJoin
	RightJoin
)
View Source
const (
	Union = SetOpType(iota)
	Intersect
	Except
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	//Family Family
	Term string `json:",omitempty"`
	All  bool   `json:",omitempty"`
}

type Create

type Create struct {
	Schema Schema
	Query  *Select
	Index  *Index
	View   View //TODO pointerize
	Errors []error
}

type Drop

type Drop struct {
	IfExists bool
	TableRef *TableRef `json:",omitempty"`
	Errors   []error
}

type Evaluator

type Evaluator struct {
	// TODO want functions that can return ([][]colval.ColumnValue,error)
	Func   func(map[string]colval.ColumnValue) colval.ColumnValue
	Inputs map[string]struct{}
}

type Expression

type Expression struct {
	Parser parse.Parser
	Create *Create `json:",omitempty"`
	Drop   *Drop   `json:",omitempty"`
	Insert *Insert `json:",omitempty"`
	Select *Select `json:",omitempty"`
	Errors []error
}

type FromItem

type FromItem struct {
	TableRef *TableRef `json:",omitempty"`
	Subquery *Select   `json:",omitempty"`
	Alias    string    `json:",omitempty"`
}

type Func

type Func struct {
	Aggregate bool
	Name      string
	RowFunc   func(Row) colval.ColumnValue
}

type Index

type Index struct {
	Table string
	Expr  *Evaluator
}

type Insert

type Insert struct {
	Schema Schema
	Query  *Select
	Values *Values
	Errors []error
}

type Join

type Join struct {
	JoinType JoinType   `json:",omitempty"`
	Right    FromItem   `json:",omitempty"`
	Alias    string     `json:",omitempty"` // TODO: consolidate in Right.Alias
	On       *Evaluator `json:",omitempty"`
	Using    []string   `json:",omitempty"`
}

type JoinType

type JoinType int

type OrderBy

type OrderBy struct {
	Expression   *Evaluator
	OutputColumn int
	Desc         bool
	NullsFirst   bool
}

type OutputExpression

type OutputExpression struct {
	Expression SelectExpression `json:",omitempty"`
	Alias      string           `json:",omitempty"`
}

type Row

type Row []colval.ColumnValue

func (Row) String

func (r Row) String() string

type RowIterator

type RowIterator interface {
	Next() (*Row, error)
	Schema() *Schema
}

type Schema

type Schema struct {
	Name       string             `json:",omitempty"`
	Sources    map[string]*Schema `json:",omitempty"` // functions/tables
	Columns    []SchemaColumn     `json:",omitempty"`
	PrimaryKey []string           `json:",omitempty"`
}

type SchemaColumn

type SchemaColumn struct {
	Source       string             `json:",omitempty"`
	SourceColumn string             `json:",omitempty"`
	Name         string             `json:",omitempty"`
	DefaultType  string             `json:",omitempty"`
	NotNull      bool               `json:",omitempty"`
	Unique       bool               `json:",omitempty"`
	Default      colval.ColumnValue `json:",omitempty"`
}

type Select

type Select struct {
	Create      *Create            `json:",omitempty"`
	With        []With             `json:",omitempty"` // TODO generalize With,Values,Tables to FromItems
	Expressions []OutputExpression `json:",omitempty"`
	FromItems   []FromItem         `json:",omitempty"`
	Values      *Values            `json:",omitempty"`
	Where       *Evaluator         `json:",omitempty"`
	Join        []Join             `json:",omitempty"`
	SetOp       *SetOp             `json:",omitempty"`
	OrderBy     []OrderBy          `json:",omitempty"`
	Limit       *int64             `json:",omitempty"`
	Offset      *int64             `json:",omitempty"`
	Schema      Schema             `json:",omitempty"`
	Errors      []error            // schema errors
}

type SelectExpression

type SelectExpression struct {
	Column *Column `json:",omitempty"`
	Func   *Func   `json:",omitempty"`
}

type SetOp

type SetOp struct {
	Op    SetOpType `json:",omitempty"`
	All   bool      `json:",omitempty"`
	Right *Select   `json:",omitempty"`
}

type SetOpType

type SetOpType int

type Source

type Source struct {
	RowIterator func() RowIterator
	Schema      func() Schema
}

type TableRef

type TableRef struct {
	Schema string `json:",omitempty"`
	Table  string `json:",omitempty"`
}

type Values

type Values struct {
	Name   string
	Rows   []Row  `json:",omitempty"`
	Schema Schema `json:",omitempty"`
	Errors []error
}

type View

type View struct {
	Columns         Schema
	ReplaceIfExists bool
}

type With

type With struct {
	Name   string `json:",omitempty"`
	Schema Schema
	Select Select `json:",omitempty"`
	Errors []error
}

Jump to

Keyboard shortcuts

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