Documentation ¶
Overview ¶
Package query implements query parsing, optimization, and execution.
Query Table Nothing ProjectNone schemaTable Tables TablesLookup Columns Indexes History Query1 Extend Project / Remove Rename Sort Summarize TempIndex Where View Query2 Compatible Union Compatible1 Intersect Minus joinLike Times joinBase Join LeftJoin
Index ¶
- Variables
- func CalcSelf(q0 Query)
- func DoAction(th *Thread, ut *db19.UpdateTran, action string) int
- func DoAdmin(db *db19.Database, cmd string, sv *Sviews)
- func Format(t QueryTran, query string) string
- func LookupCost(q Query, mode Mode, index []string, nrows int) (Cost, Cost)
- func NewAdminParser(src string) *adminParser
- func NewQueryParser(src string, t QueryTran, sv *Sviews) *queryParser
- func NewSuQueryNode(q Query) Value
- func Setup(q Query, mode Mode, t QueryTran) (Query, Cost, Cost)
- func Setup1(q Query, mode Mode, t QueryTran) (Query, Cost, Cost)
- func Strategy(q Query) string
- func String(q Query) string
- func Warnings(query string, q Query)
- type Action
- type Admin
- type Columns
- func (cs *Columns) Columns() []string
- func (*Columns) Fixed() []Fixed
- func (cs *Columns) Get(_ *Thread, dir Dir) Row
- func (*Columns) Header() *Header
- func (*Columns) Indexes() [][]string
- func (*Columns) Init()
- func (*Columns) Keys() [][]string
- func (*Columns) Lookup(*Thread, []string, []string) Row
- func (st *Columns) Metrics() *metrics
- func (cs *Columns) Nrows() (int, int)
- func (*Columns) Order() []string
- func (*Columns) Output(th *Thread, _ Record)
- func (cs *Columns) Rewind()
- func (*Columns) Select([]string, []string)
- func (cs *Columns) SetTran(tran QueryTran)
- func (*Columns) Simple(*Thread) []Row
- func (*Columns) SingleTable() bool
- func (*Columns) String() string
- func (cs *Columns) Transform() Query
- func (*Columns) Updateable() string
- func (q *Columns) ValueGet(key Value) Value
- type Compatible
- func (q *Compatible) Columns() []string
- func (q *Compatible) Fixed() []Fixed
- func (q *Compatible) Header() *Header
- func (q *Compatible) Indexes() [][]string
- func (q *Compatible) Keys() [][]string
- func (q *Compatible) Metrics() *metrics
- func (q *Compatible) Nrows() (int, int)
- func (*Compatible) Order() []string
- func (c *Compatible) SetTran(t QueryTran)
- func (c *Compatible) String(s string) string
- func (*Compatible) Updateable() string
- type Compatible1
- func (q *Compatible1) Columns() []string
- func (q *Compatible1) Fixed() []Fixed
- func (q *Compatible1) Header() *Header
- func (q *Compatible1) Indexes() [][]string
- func (q *Compatible1) Keys() [][]string
- func (q *Compatible1) Metrics() *metrics
- func (q *Compatible1) Nrows() (int, int)
- func (*Compatible1) Order() []string
- func (c1 *Compatible1) Rewind()
- func (c1 *Compatible1) Select(cols, vals []string)
- func (*Compatible1) Updateable() string
- type Cost
- type Extend
- func (q *Extend) Columns() []string
- func (e *Extend) Fixed() []Fixed
- func (e *Extend) Get(th *Thread, dir Dir) Row
- func (q *Extend) Header() *Header
- func (q *Extend) Indexes() [][]string
- func (q *Extend) Keys() [][]string
- func (e *Extend) Lookup(th *Thread, cols, vals []string) Row
- func (q *Extend) Metrics() *metrics
- func (q *Extend) Nrows() (int, int)
- func (*Extend) Order() []string
- func (e *Extend) Select(cols, vals []string)
- func (e *Extend) SetTran(t QueryTran)
- func (e *Extend) Simple(th *Thread) []Row
- func (q *Extend) SingleTable() bool
- func (e *Extend) String() string
- func (e *Extend) Transform() Query
- func (q *Extend) ValueGet(key Value) Value
- type Fixed
- type History
- func (*History) Columns() []string
- func (*History) Fixed() []Fixed
- func (his *History) Get(_ *Thread, dir Dir) Row
- func (*History) Header() *Header
- func (*History) Indexes() [][]string
- func (*History) Init()
- func (*History) Keys() [][]string
- func (*History) Lookup(*Thread, []string, []string) Row
- func (st *History) Metrics() *metrics
- func (his *History) Nrows() (int, int)
- func (*History) Order() []string
- func (*History) Output(th *Thread, _ Record)
- func (his *History) Rewind()
- func (*History) Select([]string, []string)
- func (his *History) SetTran(tran QueryTran)
- func (*History) Simple(*Thread) []Row
- func (*History) SingleTable() bool
- func (*History) String() string
- func (his *History) Transform() Query
- func (*History) Updateable() string
- func (q *History) ValueGet(key Value) Value
- type Index
- type Indexes
- func (*Indexes) Columns() []string
- func (*Indexes) Fixed() []Fixed
- func (is *Indexes) Get(_ *Thread, dir Dir) Row
- func (*Indexes) Header() *Header
- func (*Indexes) Indexes() [][]string
- func (*Indexes) Init()
- func (*Indexes) Keys() [][]string
- func (*Indexes) Lookup(*Thread, []string, []string) Row
- func (st *Indexes) Metrics() *metrics
- func (is *Indexes) Nrows() (int, int)
- func (*Indexes) Order() []string
- func (*Indexes) Output(th *Thread, _ Record)
- func (is *Indexes) Rewind()
- func (*Indexes) Select([]string, []string)
- func (is *Indexes) SetTran(tran QueryTran)
- func (*Indexes) Simple(*Thread) []Row
- func (*Indexes) SingleTable() bool
- func (*Indexes) String() string
- func (is *Indexes) Transform() Query
- func (*Indexes) Updateable() string
- func (q *Indexes) ValueGet(key Value) Value
- type Intersect
- func (q *Intersect) Columns() []string
- func (q *Intersect) Fixed() []Fixed
- func (it *Intersect) Get(th *Thread, dir Dir) Row
- func (q *Intersect) Header() *Header
- func (q *Intersect) Indexes() [][]string
- func (q *Intersect) Keys() [][]string
- func (it *Intersect) Lookup(th *Thread, cols, vals []string) Row
- func (q *Intersect) Metrics() *metrics
- func (q *Intersect) Nrows() (int, int)
- func (*Intersect) Order() []string
- func (it *Intersect) Simple(th *Thread) []Row
- func (it *Intersect) String() string
- func (it *Intersect) Transform() Query
- func (*Intersect) Updateable() string
- func (q *Intersect) ValueGet(key Value) Value
- type Join
- func (jn *Join) Get(th *Thread, dir Dir) Row
- func (jn *Join) Lookup(th *Thread, cols, vals []string) Row
- func (jb *Join) Rewind()
- func (jn *Join) Select(cols, vals []string)
- func (jb *Join) SetTran(qt QueryTran)
- func (jn *Join) Simple(th *Thread) []Row
- func (jn *Join) String() string
- func (jn *Join) Transform() Query
- func (q *Join) ValueGet(key Value) Value
- func (jn *Join) With(src1, src2 Query) *Join
- type LeftJoin
- func (lj *LeftJoin) Get(th *Thread, dir Dir) (r Row)
- func (lj *LeftJoin) Lookup(th *Thread, cols, vals []string) Row
- func (jb *LeftJoin) Rewind()
- func (lj *LeftJoin) Select(cols, vals []string)
- func (jb *LeftJoin) SetTran(qt QueryTran)
- func (lj *LeftJoin) Simple(th *Thread) []Row
- func (lj *LeftJoin) String() string
- func (lj *LeftJoin) Transform() Query
- func (q *LeftJoin) ValueGet(key Value) Value
- func (lj *LeftJoin) With(src1, src2 Query) *LeftJoin
- type Minus
- func (q *Minus) Columns() []string
- func (q *Minus) Fixed() []Fixed
- func (m *Minus) Get(th *Thread, dir Dir) Row
- func (q *Minus) Header() *Header
- func (q *Minus) Indexes() [][]string
- func (q *Minus) Keys() [][]string
- func (m *Minus) Lookup(th *Thread, cols, vals []string) Row
- func (q *Minus) Metrics() *metrics
- func (q *Minus) Nrows() (int, int)
- func (*Minus) Order() []string
- func (m *Minus) Simple(th *Thread) []Row
- func (m *Minus) String() string
- func (m *Minus) Transform() Query
- func (*Minus) Updateable() string
- func (q *Minus) ValueGet(key Value) Value
- type Mode
- type Nothing
- func (q *Nothing) Columns() []string
- func (q *Nothing) Fixed() []Fixed
- func (*Nothing) Get(*Thread, Dir) Row
- func (q *Nothing) Header() *Header
- func (*Nothing) Indexes() [][]string
- func (*Nothing) Keys() [][]string
- func (*Nothing) Lookup(*Thread, []string, []string) Row
- func (q *Nothing) Metrics() *metrics
- func (*Nothing) Nrows() (int, int)
- func (*Nothing) Order() []string
- func (no *Nothing) Output(th *Thread, rec Record)
- func (*Nothing) Rewind()
- func (*Nothing) Select([]string, []string)
- func (no *Nothing) SetTran(tran QueryTran)
- func (*Nothing) Simple(*Thread) []Row
- func (*Nothing) SingleTable() bool
- func (no *Nothing) String() string
- func (no *Nothing) Transform() Query
- func (no *Nothing) Updateable() string
- func (q *Nothing) ValueGet(key Value) Value
- type Project
- func (q *Project) Columns() []string
- func (p *Project) Fixed() []Fixed
- func (p *Project) Get(th *Thread, dir Dir) Row
- func (q *Project) Header() *Header
- func (q *Project) Indexes() [][]string
- func (q *Project) Keys() [][]string
- func (p *Project) Lookup(th *Thread, cols, vals []string) Row
- func (q *Project) Metrics() *metrics
- func (q *Project) Nrows() (int, int)
- func (*Project) Order() []string
- func (p *Project) Output(th *Thread, rec Record)
- func (p *Project) Rewind()
- func (p *Project) Select(cols, vals []string)
- func (p *Project) SetTran(t QueryTran)
- func (p *Project) Simple(th *Thread) []Row
- func (q *Project) SingleTable() bool
- func (p *Project) String() string
- func (p *Project) Transform() Query
- func (p *Project) Updateable() string
- func (q *Project) ValueGet(key Value) Value
- type ProjectNone
- func (*ProjectNone) Columns() []string
- func (*ProjectNone) Fixed() []Fixed
- func (pn *ProjectNone) Get(*Thread, Dir) Row
- func (*ProjectNone) Header() *Header
- func (*ProjectNone) Indexes() [][]string
- func (*ProjectNone) Keys() [][]string
- func (*ProjectNone) Lookup(*Thread, []string, []string) Row
- func (*ProjectNone) Metrics() *metrics
- func (*ProjectNone) Nrows() (int, int)
- func (*ProjectNone) Order() []string
- func (*ProjectNone) Output(*Thread, Record)
- func (*ProjectNone) Rewind()
- func (*ProjectNone) Select([]string, []string)
- func (*ProjectNone) SetTran(QueryTran)
- func (*ProjectNone) Simple(*Thread) []Row
- func (*ProjectNone) SingleTable() bool
- func (*ProjectNone) String() string
- func (pn *ProjectNone) Transform() Query
- func (*ProjectNone) Updateable() string
- func (q *ProjectNone) ValueGet(key Value) Value
- type Query
- func JustParse(t QueryTran, query string) Query
- func NewJoin(src1, src2 Query, by []string, t QueryTran) Query
- func NewTable(t QueryTran, name string) Query
- func ParseQuery(src string, t QueryTran, sv *Sviews) Query
- func SetApproach(q Query, index []string, frac float64, tran QueryTran) Query
- func SetupKey(q Query, mode Mode, t QueryTran) Query
- type Query1
- func (q *Query1) Columns() []string
- func (q *Query1) Fixed() []Fixed
- func (q *Query1) Header() *Header
- func (q *Query1) Indexes() [][]string
- func (q *Query1) Keys() [][]string
- func (*Query1) Lookup(*Thread, []string, []string) Row
- func (q *Query1) Metrics() *metrics
- func (q *Query1) Nrows() (int, int)
- func (*Query1) Order() []string
- func (q1 *Query1) Output(th *Thread, rec Record)
- func (q1 *Query1) Rewind()
- func (q1 *Query1) SetTran(t QueryTran)
- func (q *Query1) SingleTable() bool
- func (q1 *Query1) Source() Query
- func (q1 *Query1) Updateable() string
- type Query2
- func (q *Query2) Columns() []string
- func (q *Query2) Fixed() []Fixed
- func (q *Query2) Header() *Header
- func (q *Query2) Indexes() [][]string
- func (q *Query2) Keys() [][]string
- func (q *Query2) Metrics() *metrics
- func (q *Query2) Nrows() (int, int)
- func (*Query2) Order() []string
- func (*Query2) Output(*Thread, Record)
- func (q2 *Query2) SetTran(t QueryTran)
- func (q2 *Query2) SingleTable() bool
- func (q2 *Query2) Source() Query
- func (q2 *Query2) Source2() Query
- func (*Query2) Updateable() string
- type QueryTran
- type Rename
- func (q *Rename) Columns() []string
- func (r *Rename) Fixed() []Fixed
- func (r *Rename) Get(th *Thread, dir Dir) Row
- func (q *Rename) Header() *Header
- func (q *Rename) Indexes() [][]string
- func (q *Rename) Keys() [][]string
- func (r *Rename) Lookup(th *Thread, cols, vals []string) Row
- func (q *Rename) Metrics() *metrics
- func (q *Rename) Nrows() (int, int)
- func (*Rename) Order() []string
- func (r *Rename) Select(cols, vals []string)
- func (r *Rename) Simple(th *Thread) []Row
- func (q *Rename) SingleTable() bool
- func (r *Rename) String() string
- func (r *Rename) Transform() Query
- func (q *Rename) ValueGet(key Value) Value
- type Renames
- type Schema
- type Sort
- func (q *Sort) Columns() []string
- func (q *Sort) Fixed() []Fixed
- func (sort *Sort) Get(th *Thread, dir Dir) Row
- func (q *Sort) Header() *Header
- func (*Sort) Indexes() [][]string
- func (q *Sort) Keys() [][]string
- func (q *Sort) Metrics() *metrics
- func (q *Sort) Nrows() (int, int)
- func (sort *Sort) Order() []string
- func (sort *Sort) Select(cols, vals []string)
- func (sort *Sort) Simple(th *Thread) []Row
- func (q *Sort) SingleTable() bool
- func (sort *Sort) String() string
- func (sort *Sort) Transform() Query
- func (q *Sort) ValueGet(key Value) Value
- type SuQueryNode
- type Summarize
- func (q *Summarize) Columns() []string
- func (q *Summarize) Fixed() []Fixed
- func (su *Summarize) Get(th *Thread, dir Dir) Row
- func (q *Summarize) Header() *Header
- func (q *Summarize) Indexes() [][]string
- func (q *Summarize) Keys() [][]string
- func (su *Summarize) Len() int
- func (su *Summarize) Less(i, j int) bool
- func (su *Summarize) Lookup(th *Thread, cols, vals []string) Row
- func (q *Summarize) Metrics() *metrics
- func (q *Summarize) Nrows() (int, int)
- func (*Summarize) Order() []string
- func (*Summarize) Output(*Thread, Record)
- func (su *Summarize) Rewind()
- func (su *Summarize) Select(cols, vals []string)
- func (su *Summarize) SetTran(t QueryTran)
- func (*Summarize) Simple(*Thread) []Row
- func (su *Summarize) SingleTable() bool
- func (su *Summarize) String() string
- func (su *Summarize) Swap(i, j int)
- func (su *Summarize) Transform() Query
- func (su *Summarize) Updateable() string
- func (q *Summarize) ValueGet(key Value) Value
- type Table
- func (q *Table) Columns() []string
- func (tbl *Table) Fixed() []Fixed
- func (tbl *Table) Get(_ *Thread, dir Dir) Row
- func (q *Table) Header() *Header
- func (q *Table) Indexes() [][]string
- func (q *Table) Keys() [][]string
- func (tbl *Table) Lookup(_ *Thread, cols, vals []string) Row
- func (q *Table) Metrics() *metrics
- func (tbl *Table) Nrows() (int, int)
- func (*Table) Order() []string
- func (tbl *Table) Output(th *Thread, rec Record)
- func (tbl *Table) Rewind()
- func (tbl *Table) Select(cols, vals []string)
- func (tbl *Table) SelectRaw(org, end string)
- func (tbl *Table) SetTran(t QueryTran)
- func (tbl *Table) Simple(*Thread) []Row
- func (tbl *Table) SingleTable() bool
- func (tbl *Table) String() string
- func (tbl *Table) Transform() Query
- func (tbl *Table) Updateable() string
- func (q *Table) ValueGet(key Value) Value
- type Tables
- func (*Tables) Columns() []string
- func (*Tables) Fixed() []Fixed
- func (ts *Tables) Get(_ *Thread, dir Dir) Row
- func (*Tables) Header() *Header
- func (*Tables) Indexes() [][]string
- func (*Tables) Init()
- func (*Tables) Keys() [][]string
- func (*Tables) Lookup(*Thread, []string, []string) Row
- func (st *Tables) Metrics() *metrics
- func (ts *Tables) Nrows() (int, int)
- func (*Tables) Order() []string
- func (*Tables) Output(th *Thread, _ Record)
- func (ts *Tables) Rewind()
- func (*Tables) Select([]string, []string)
- func (ts *Tables) SetTran(tran QueryTran)
- func (*Tables) Simple(*Thread) []Row
- func (*Tables) SingleTable() bool
- func (*Tables) String() string
- func (ts *Tables) Transform() Query
- func (*Tables) Updateable() string
- func (q *Tables) ValueGet(key Value) Value
- type TablesLookup
- func (*TablesLookup) Fixed() []Fixed
- func (tl *TablesLookup) Get(*Thread, Dir) Row
- func (*TablesLookup) Indexes() [][]string
- func (*TablesLookup) Init()
- func (*TablesLookup) Lookup(*Thread, []string, []string) Row
- func (st *TablesLookup) Metrics() *metrics
- func (*TablesLookup) Nrows() (int, int)
- func (*TablesLookup) Order() []string
- func (*TablesLookup) Output(th *Thread, _ Record)
- func (*TablesLookup) Select([]string, []string)
- func (*TablesLookup) Simple(*Thread) []Row
- func (*TablesLookup) SingleTable() bool
- func (tl *TablesLookup) String() string
- func (tl *TablesLookup) Transform() Query
- func (*TablesLookup) Updateable() string
- func (q *TablesLookup) ValueGet(key Value) Value
- type TempIndex
- func (q *TempIndex) Columns() []string
- func (q *TempIndex) Fixed() []Fixed
- func (ti *TempIndex) Get(th *Thread, dir Dir) Row
- func (q *TempIndex) Header() *Header
- func (*TempIndex) Indexes() [][]string
- func (q *TempIndex) Keys() [][]string
- func (ti *TempIndex) Lookup(th *Thread, cols, vals []string) Row
- func (q *TempIndex) Metrics() *metrics
- func (q *TempIndex) Nrows() (int, int)
- func (*TempIndex) Order() []string
- func (ti *TempIndex) Rewind()
- func (ti *TempIndex) Select(cols, vals []string)
- func (*TempIndex) Simple(*Thread) []Row
- func (q *TempIndex) SingleTable() bool
- func (ti *TempIndex) String() string
- func (ti *TempIndex) Transform() Query
- func (q *TempIndex) ValueGet(key Value) Value
- type Times
- func (t *Times) Get(th *Thread, dir Dir) Row
- func (t *Times) Lookup(th *Thread, cols, vals []string) Row
- func (t *Times) Rewind()
- func (t *Times) Select(cols, vals []string)
- func (t *Times) Simple(th *Thread) []Row
- func (t *Times) String() string
- func (t *Times) Transform() Query
- func (q *Times) ValueGet(key Value) Value
- type Union
- func (q *Union) Columns() []string
- func (u *Union) Fixed() []Fixed
- func (u *Union) Get(th *Thread, dir Dir) Row
- func (q *Union) Header() *Header
- func (q *Union) Indexes() [][]string
- func (u *Union) Keys() [][]string
- func (u *Union) Lookup(th *Thread, cols, vals []string) Row
- func (q *Union) Metrics() *metrics
- func (q *Union) Nrows() (int, int)
- func (*Union) Order() []string
- func (u *Union) Rewind()
- func (u *Union) Select(cols, vals []string)
- func (u *Union) Simple(th *Thread) []Row
- func (u *Union) String() string
- func (u *Union) Transform() Query
- func (*Union) Updateable() string
- func (q *Union) ValueGet(key Value) Value
- type View
- func (q *View) Columns() []string
- func (q *View) Fixed() []Fixed
- func (v *View) Get(th *Thread, dir Dir) Row
- func (q *View) Header() *Header
- func (q *View) Indexes() [][]string
- func (q *View) Keys() [][]string
- func (v *View) Lookup(th *Thread, cols []string, vals []string) Row
- func (q *View) Metrics() *metrics
- func (q *View) Nrows() (int, int)
- func (*View) Order() []string
- func (v *View) Select(cols []string, vals []string)
- func (*View) Simple(*Thread) []Row
- func (q *View) SingleTable() bool
- func (v *View) String() string
- func (v *View) Transform() Query
- func (q *View) ValueGet(key Value) Value
- type Views
- func (*Views) Columns() []string
- func (*Views) Fixed() []Fixed
- func (vs *Views) Get(_ *Thread, dir Dir) Row
- func (*Views) Header() *Header
- func (*Views) Indexes() [][]string
- func (*Views) Init()
- func (*Views) Keys() [][]string
- func (vs *Views) Len() int
- func (vs *Views) Less(i, j int) bool
- func (*Views) Lookup(*Thread, []string, []string) Row
- func (st *Views) Metrics() *metrics
- func (vs *Views) Nrows() (int, int)
- func (*Views) Order() []string
- func (*Views) Output(th *Thread, _ Record)
- func (vs *Views) Rewind()
- func (*Views) Select([]string, []string)
- func (vs *Views) SetTran(tran QueryTran)
- func (*Views) Simple(*Thread) []Row
- func (*Views) SingleTable() bool
- func (*Views) String() string
- func (vs *Views) Swap(i, j int)
- func (vs *Views) Transform() Query
- func (*Views) Updateable() string
- func (q *Views) ValueGet(key Value) Value
- type Where
- func (q *Where) Columns() []string
- func (q *Where) Fixed() []Fixed
- func (w *Where) Get(th *Thread, dir Dir) Row
- func (q *Where) Header() *Header
- func (w *Where) Indexes() [][]string
- func (w *Where) Keys() [][]string
- func (w *Where) Lookup(th *Thread, cols, vals []string) Row
- func (q *Where) Metrics() *metrics
- func (w *Where) Nrows() (int, int)
- func (*Where) Order() []string
- func (w *Where) Rewind()
- func (w *Where) Select(cols, vals []string)
- func (w *Where) SetTran(t QueryTran)
- func (w *Where) Simple(th *Thread) []Row
- func (q *Where) SingleTable() bool
- func (w *Where) String() string
- func (w *Where) Transform() Query
- func (q *Where) ValueGet(key Value) Value
Constants ¶
This section is empty.
Variables ¶
var HistoryFields = [][]string{{"asof"}}
var MakeSuTran func(qt QueryTran) *SuTran
MakeSuTran is injected by dbms to avoid import cycle
var Two = IntVal(2)
Functions ¶
func NewAdminParser ¶
func NewAdminParser(src string) *adminParser
func NewQueryParser ¶
func NewSuQueryNode ¶
func NewSuQueryNode(q Query) Value
func Setup ¶
Setup prepares a parsed query for execution. It calls Transform, Optimize, and SetApproach. The resulting Query is ready for execution.
Types ¶
type Action ¶
type Action interface { String() string // contains filtered or unexported methods }
func ParseAction ¶
ParseAction parses insert, update, and delete actions
type Admin ¶
type Admin interface { String() string // contains filtered or unexported methods }
func ParseAdmin ¶
type Columns ¶
type Columns struct {
// contains filtered or unexported fields
}
func (*Columns) SingleTable ¶
func (*Columns) SingleTable() bool
func (*Columns) Updateable ¶
func (*Columns) Updateable() string
type Compatible ¶
type Compatible struct { Query2 // contains filtered or unexported fields }
Compatible is shared by Intersect, Minus, and Union
func (*Compatible) SetTran ¶
func (c *Compatible) SetTran(t QueryTran)
func (*Compatible) String ¶
func (c *Compatible) String(s string) string
func (*Compatible) Updateable ¶
func (*Compatible) Updateable() string
Updateable is overridden by Query1
type Compatible1 ¶
type Compatible1 struct {
Compatible
}
Compatible1 is embedded by Intersect and Minus (that return a subset of source1 records)
func (*Compatible1) Rewind ¶
func (c1 *Compatible1) Rewind()
func (*Compatible1) Select ¶
func (c1 *Compatible1) Select(cols, vals []string)
func (*Compatible1) Updateable ¶
func (*Compatible1) Updateable() string
Updateable is overridden by Query1
type Extend ¶
type Extend struct { Query1 // contains filtered or unexported fields }
func (*Extend) SingleTable ¶
func (q *Extend) SingleTable() bool
type History ¶
type History struct {
// contains filtered or unexported fields
}
func (*History) SingleTable ¶
func (*History) SingleTable() bool
func (*History) Updateable ¶
func (*History) Updateable() string
type Indexes ¶
type Indexes struct {
// contains filtered or unexported fields
}
func (*Indexes) SingleTable ¶
func (*Indexes) SingleTable() bool
func (*Indexes) Updateable ¶
func (*Indexes) Updateable() string
type Intersect ¶
type Intersect struct { Compatible1 // contains filtered or unexported fields }
func NewIntersect ¶
func (*Intersect) Updateable ¶
func (*Intersect) Updateable() string
Updateable is overridden by Query1
type Minus ¶
type Minus struct {
Compatible1
}
type Mode ¶
type Mode int
Mode is the transaction context - cursor, read, or update. It affects the use of temporary indexes.
type Nothing ¶
type Nothing struct {
// contains filtered or unexported fields
}
Nothing is a null query that produces no output. It results from a Join, Where, or Intersect with a Fixed conflict. It is not generated by the query parser.
func NewNothing ¶
func (*Nothing) SingleTable ¶
func (*Nothing) Updateable ¶
type Project ¶
type Project struct { Query1 // contains filtered or unexported fields }
func NewProject ¶
func (*Project) SingleTable ¶
func (q *Project) SingleTable() bool
func (*Project) Updateable ¶
type ProjectNone ¶
type ProjectNone struct {
// contains filtered or unexported fields
}
ProjectNone produces a single empty row with no columns. It results from a Project with no columns. It is not generated by the query parser.
func (*ProjectNone) Columns ¶
func (*ProjectNone) Columns() []string
func (*ProjectNone) Fixed ¶
func (*ProjectNone) Fixed() []Fixed
func (*ProjectNone) Get ¶
func (pn *ProjectNone) Get(*Thread, Dir) Row
func (*ProjectNone) Header ¶
func (*ProjectNone) Header() *Header
func (*ProjectNone) Indexes ¶
func (*ProjectNone) Indexes() [][]string
func (*ProjectNone) Keys ¶
func (*ProjectNone) Keys() [][]string
func (*ProjectNone) Lookup ¶
func (*ProjectNone) Lookup(*Thread, []string, []string) Row
func (*ProjectNone) Metrics ¶
func (*ProjectNone) Metrics() *metrics
func (*ProjectNone) Nrows ¶
func (*ProjectNone) Nrows() (int, int)
func (*ProjectNone) Order ¶
func (*ProjectNone) Order() []string
func (*ProjectNone) Output ¶
func (*ProjectNone) Output(*Thread, Record)
func (*ProjectNone) Rewind ¶
func (*ProjectNone) Rewind()
func (*ProjectNone) Select ¶
func (*ProjectNone) Select([]string, []string)
func (*ProjectNone) SetTran ¶
func (*ProjectNone) SetTran(QueryTran)
func (*ProjectNone) Simple ¶
func (*ProjectNone) Simple(*Thread) []Row
func (*ProjectNone) SingleTable ¶
func (*ProjectNone) SingleTable() bool
func (*ProjectNone) String ¶
func (*ProjectNone) String() string
func (*ProjectNone) Transform ¶
func (pn *ProjectNone) Transform() Query
func (*ProjectNone) Updateable ¶
func (*ProjectNone) Updateable() string
func (*ProjectNone) ValueGet ¶
func (q *ProjectNone) ValueGet(key Value) Value
type Query ¶
type Query interface { // Columns is all the available columns, including derived Columns() []string // Transform refactors the query for more efficient execution. // This stage is not cost based, transforms are applied when possible. // // Transform methods MUST ensure they call Transform on their children. // Transform is (mostly) bottom up, partly for path copying. // Which means Transform methods should start by calling Transform // on their children. // // Any changes should build new nodes, NOT modify nodes. // This is partly to ensure that constructor validation is done. Transform() Query // SetTran is used for cursors SetTran(tran QueryTran) // Order is nil for everything except Sort Order() []string // Fixed returns the field values that are constant from Extend or Where Fixed() []Fixed // Updateable returns the table name if the rows from the query can be updated // else "" Updateable() string // SingleTable is used by TempIndex. // It is true if the query Get returns a single record stored in the database SingleTable() bool // Indexes returns all the indexes. // Unlike Keys, Indexes are physical i.e. fast access paths. // Where returns []string{} not nil for singleton. (slc.Empty) Indexes() [][]string // Keys returns sets of fields that are unique keys. // On a table this will be the key indexes, but on other operations // this is logical, there may not necessarily be an index. Keys() [][]string // Nrows returns n the number of expected result rows from the query, // and p the "population" it was drawn from. // For example, a Where on a key selects a single row (n = 1), // from the entire table with p rows. // // Nrows should be the same regardless of the strategy. // For symmetrical/reversible operations e.g. join or union // it should give the same result both ways. // // Nrows does *not* incorporate frac Nrows() (n, p int) // Rewind resets the query so Get Next gets first, or Prev gets last // It does *not* clear any Select. Rewind() Get(th *Thread, dir Dir) Row // Lookup returns the row matching the given key value, or nil if not found. // It is used by Where and Compatible (Intersect, Minus, Union) // It is valid (although not necessarily the most efficient) // to implement Lookup with Select and Get // in which case it should leave the select cleared. // Lookup should rewind. Lookup(th *Thread, cols, vals []string) Row // Select restricts the query to records matching the given packed values. // It is used by Where, Join, and LeftJoin. // To clear the select, use Select(nil, nil) // Select should rewind. Select(cols, vals []string) Header() *Header Output(th *Thread, rec Record) String() string // Simple is simple, alternate execution method for testing. // It should normally be used after just parsing, // without transform or optimize. Simple(th *Thread) []Row // ValueGet is for Suneido.ParseQuery and queryvalue.go // It would be Get, but that is already used in Query. ValueGet(key Value) Value Metrics() *metrics // contains filtered or unexported methods }
func ParseQuery ¶
func SetApproach ¶
SetApproach finalizes the chosen approach. It also adds temp indexes where required.
type Query1 ¶
type Query1 struct {
// contains filtered or unexported fields
}
func (*Query1) SingleTable ¶
func (q *Query1) SingleTable() bool
func (*Query1) Updateable ¶
type Query2 ¶
type Query2 struct {
// contains filtered or unexported fields
}
func (*Query2) SingleTable ¶
type QueryTran ¶
type QueryTran interface { GetSchema(table string) *schema.Schema GetInfo(table string) *meta.Info GetAllInfo() []*meta.Info GetAllSchema() []*meta.Schema GetAllViews() []string GetView(string) string GetStore() *stor.Stor RangeFrac(table string, iIndex int, org, end string) float64 Lookup(table string, iIndex int, key string) *DbRec Output(th *Thread, table string, rec Record) GetIndexI(table string, iIndex int) *index.Overlay GetRecord(off uint64) Record MakeLess(is *ixkey.Spec) func(x, y uint64) bool Read(string, int, string, string) }
type Rename ¶
type Rename struct { Query1 // contains filtered or unexported fields }
func (*Rename) SingleTable ¶
func (q *Rename) SingleTable() bool
type Sort ¶
type Sort struct { Query1 // contains filtered or unexported fields }
func (*Sort) SingleTable ¶
func (q *Sort) SingleTable() bool
type SuQueryNode ¶
type SuQueryNode struct { ValueBase[SuQueryNode] // contains filtered or unexported fields }
func (SuQueryNode) Equal ¶
func (SuQueryNode) Equal(any) bool
func (SuQueryNode) Get ¶
func (n SuQueryNode) Get(_ *Thread, key Value) Value
func (SuQueryNode) SetConcurrent ¶
func (SuQueryNode) SetConcurrent()
func (SuQueryNode) Type ¶
func (SuQueryNode) Type() types.Type
type Summarize ¶
type Summarize struct { Query1 // contains filtered or unexported fields }
func NewSummarize ¶
func (*Summarize) SingleTable ¶
func (*Summarize) Updateable ¶
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
func (*Table) SingleTable ¶
func (*Table) Updateable ¶
type Tables ¶
type Tables struct {
// contains filtered or unexported fields
}
func (*Tables) SingleTable ¶
func (*Tables) SingleTable() bool
func (*Tables) Updateable ¶
func (*Tables) Updateable() string
type TablesLookup ¶
type TablesLookup struct { Tables // contains filtered or unexported fields }
TablesLookup is used to optimize lookups on tables. It is inserted by Where Transform.
func NewTablesLookup ¶
func NewTablesLookup(tran QueryTran, table string) *TablesLookup
func (*TablesLookup) Get ¶
func (tl *TablesLookup) Get(*Thread, Dir) Row
func (*TablesLookup) Nrows ¶
func (*TablesLookup) Nrows() (int, int)
func (*TablesLookup) SingleTable ¶
func (*TablesLookup) SingleTable() bool
func (*TablesLookup) String ¶
func (tl *TablesLookup) String() string
func (*TablesLookup) Transform ¶
func (tl *TablesLookup) Transform() Query
func (*TablesLookup) Updateable ¶
func (*TablesLookup) Updateable() string
func (*TablesLookup) ValueGet ¶
func (q *TablesLookup) ValueGet(key Value) Value
type TempIndex ¶
type TempIndex struct { Query1 // contains filtered or unexported fields }
TempIndex is inserted by SetApproach as required. It builds a sortlist of either DbRec or Row. Keys are not constructed for the index or Lookup/Select so there are no size limits.
func (*TempIndex) SingleTable ¶
func (q *TempIndex) SingleTable() bool
type Union ¶
type Union struct { Compatible // contains filtered or unexported fields }
type View ¶
type View struct { Query1 // contains filtered or unexported fields }
View is a pass-through wrapper around a Query it is optionally added by parsequery so that format doesn't expand views. It should not be used when doing Transform and Optimize because it blocks identification of child queries.
func (*View) SingleTable ¶
func (q *View) SingleTable() bool
type Views ¶
type Views struct {
// contains filtered or unexported fields
}
func (*Views) SingleTable ¶
func (*Views) SingleTable() bool
func (*Views) Updateable ¶
func (*Views) Updateable() string
Source Files ¶
- action.go
- admin.go
- cache.go
- compatible.go
- expr.go
- extend.go
- fixed.go
- format.go
- intersect.go
- join.go
- minus.go
- nothing.go
- parseaction.go
- parseadmin.go
- parsequery.go
- project.go
- projectnone.go
- query.go
- queryvalue.go
- rename.go
- schema.go
- sort.go
- summarize.go
- table.go
- tempindex.go
- testdb.go
- testtran.go
- times.go
- union.go
- view.go
- warnings.go
- where.go
- where2.go
- where3.go