Documentation
¶
Index ¶
- type AggrType
- type AggregatePlan
- func (p *AggregatePlan) Build() error
- func (p *AggregatePlan) Children() *PlanTree
- func (p *AggregatePlan) Empty() bool
- func (p *AggregatePlan) GroupAggregators() []Aggregator
- func (p *AggregatePlan) JSON() string
- func (p *AggregatePlan) NormalAggregators() []Aggregator
- func (p *AggregatePlan) ReWritten() sqlparser.SelectExprs
- func (p *AggregatePlan) Size() int
- func (p *AggregatePlan) Type() PlanType
- type Aggregator
- type DDLPlan
- type DeletePlan
- type Direction
- type InsertPlan
- type JoinNode
- type LimitPlan
- type MergeNode
- type OrderBy
- type OrderByPlan
- type Plan
- type PlanNode
- type PlanTree
- type PlanType
- type SelectPlan
- type TableInfo
- type UpdatePlan
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggrType ¶
type AggrType string
AggrType type.
const ( // AggrTypeNull enum. AggrTypeNull AggrType = "" // AggrTypeCount enum. AggrTypeCount AggrType = "COUNT" // AggrTypeSum enum. AggrTypeSum AggrType = "SUM" // AggrTypeMin enum. AggrTypeMin AggrType = "MIN" // AggrTypeMax enum. AggrTypeMax AggrType = "MAX" // AggrTypeAvg enum. AggrTypeAvg AggrType = "AVG" // AggrTypeGroupBy enum. AggrTypeGroupBy AggrType = "GROUP BY" )
type AggregatePlan ¶
type AggregatePlan struct {
// contains filtered or unexported fields
}
AggregatePlan represents order-by plan.
func NewAggregatePlan ¶
func NewAggregatePlan(log *xlog.Log, exprs []sqlparser.SelectExpr, tuples, groups []selectTuple) *AggregatePlan
NewAggregatePlan used to create AggregatePlan.
func (*AggregatePlan) Build ¶
func (p *AggregatePlan) Build() error
Build used to build distributed querys.
func (*AggregatePlan) Children ¶
func (p *AggregatePlan) Children() *PlanTree
Children returns the children of the plan.
func (*AggregatePlan) Empty ¶
func (p *AggregatePlan) Empty() bool
Empty returns the aggregator number more than zero.
func (*AggregatePlan) GroupAggregators ¶
func (p *AggregatePlan) GroupAggregators() []Aggregator
GroupAggregators returns the group aggregators.
func (*AggregatePlan) NormalAggregators ¶
func (p *AggregatePlan) NormalAggregators() []Aggregator
NormalAggregators returns the aggregators.
func (*AggregatePlan) ReWritten ¶
func (p *AggregatePlan) ReWritten() sqlparser.SelectExprs
ReWritten used to re-write the SelectExprs clause.
func (*AggregatePlan) Type ¶
func (p *AggregatePlan) Type() PlanType
Type returns the type of the plan.
type DDLPlan ¶
type DDLPlan struct {
// raw query
RawQuery string
// mode
ReqMode xcontext.RequestMode
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
DDLPlan represents a CREATE, ALTER, DROP or RENAME plan
func NewDDLPlan ¶
func NewDDLPlan(log *xlog.Log, database string, query string, node *sqlparser.DDL, router *router.Router) *DDLPlan
NewDDLPlan used to create DDLPlan
func (*DDLPlan) Build ¶
Build used to build DDL distributed querys. sqlparser.DDL is a simple grammar ast, it just parses database and table name in the prefix.
type DeletePlan ¶
type DeletePlan struct {
// raw query
RawQuery string
// mode
ReqMode xcontext.RequestMode
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
DeletePlan represents delete plan
func NewDeletePlan ¶
func NewDeletePlan(log *xlog.Log, database string, query string, node *sqlparser.Delete, router *router.Router) *DeletePlan
NewDeletePlan used to create DeletePlan
func (*DeletePlan) Build ¶
func (p *DeletePlan) Build() error
Build used to build distributed querys.
func (*DeletePlan) Children ¶
func (p *DeletePlan) Children() *PlanTree
Children returns the children of the plan.
type InsertPlan ¶
type InsertPlan struct {
// raw query
RawQuery string
// type
Typ PlanType
// mode
ReqMode xcontext.RequestMode
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
InsertPlan represents insertion plan
func NewInsertPlan ¶
func NewInsertPlan(log *xlog.Log, database string, query string, node *sqlparser.Insert, router *router.Router) *InsertPlan
NewInsertPlan used to create InsertPlan
func (*InsertPlan) Build ¶
func (p *InsertPlan) Build() error
Build used to build distributed querys.
func (*InsertPlan) Children ¶
func (p *InsertPlan) Children() *PlanTree
Children returns the children of the plan.
type JoinNode ¶ added in v1.0.5
type JoinNode struct {
// Left and Right are the nodes for the join.
Left, Right PlanNode
// contains filtered or unexported fields
}
JoinNode cannot be pushed down.
func (*JoinNode) GetQuery ¶ added in v1.0.5
func (j *JoinNode) GetQuery() []xcontext.QueryTuple
GetQuery used to get the Querys.
type LimitPlan ¶
LimitPlan represents order-by plan.
func NewLimitPlan ¶
NewLimitPlan used to create LimitPlan.
type MergeNode ¶ added in v1.0.5
type MergeNode struct {
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
MergeNode can be pushed down.
func (*MergeNode) GetQuery ¶ added in v1.0.5
func (m *MergeNode) GetQuery() []xcontext.QueryTuple
GetQuery used to get the Querys.
type OrderByPlan ¶
type OrderByPlan struct {
OrderBys []OrderBy `json:"OrderBy(s)"`
// contains filtered or unexported fields
}
OrderByPlan represents order-by plan.
func NewOrderByPlan ¶
func NewOrderByPlan(log *xlog.Log, node *sqlparser.Select, tuples []selectTuple, tbInfos map[string]*TableInfo) *OrderByPlan
NewOrderByPlan used to create OrderByPlan.
func (*OrderByPlan) Build ¶
func (p *OrderByPlan) Build() error
Build used to build distributed querys.
func (*OrderByPlan) Children ¶
func (p *OrderByPlan) Children() *PlanTree
Children returns the children of the plan.
type PlanNode ¶ added in v1.0.5
type PlanNode interface {
Children() *PlanTree
GetQuery() []xcontext.QueryTuple
// contains filtered or unexported methods
}
PlanNode interface.
type PlanTree ¶
type PlanTree struct {
// contains filtered or unexported fields
}
PlanTree is a container for all plans
type PlanType ¶
type PlanType string
PlanType type.
const ( // PlanTypeDDL enum. PlanTypeDDL PlanType = "PlanTypeDDL" // PlanTypeInsert enum. PlanTypeInsert PlanType = "PlanTypeInsert" // PlanTypeDelete enum. PlanTypeDelete PlanType = "PlanTypeDelete" // PlanTypeUpdate enum. PlanTypeUpdate PlanType = "PlanTypeUpdate" // PlanTypeSelect enum. PlanTypeSelect PlanType = "PlanTypeSelect" // PlanTypeOrderby enum. PlanTypeOrderby PlanType = "PlanTypeOrderby" // PlanTypeLimit enum. PlanTypeLimit PlanType = "PlanTypeLimit" // PlanTypeAggregate enum. PlanTypeAggregate PlanType = "PlanTypeAggregate" // PlanTypeJoin enum. PlanTypeJoin PlanType = "PlanTypeJoin" // PlanTypeDistinct enum. PlanTypeDistinct PlanType = "PlanTypeDistinct" )
type SelectPlan ¶
type SelectPlan struct {
// raw query
RawQuery string
// mode
ReqMode xcontext.RequestMode
Root PlanNode
// contains filtered or unexported fields
}
SelectPlan represents select plan.
func NewSelectPlan ¶
func NewSelectPlan(log *xlog.Log, database string, query string, node *sqlparser.Select, router *router.Router) *SelectPlan
NewSelectPlan used to create SelectPlan.
func (*SelectPlan) Build ¶
func (p *SelectPlan) Build() error
Build used to build distributed querys. For now, we don't support subquery in select.
func (*SelectPlan) Children ¶
func (p *SelectPlan) Children() *PlanTree
Children returns the children of the plan.
type TableInfo ¶ added in v1.0.3
type TableInfo struct {
// table's route.
Segments []router.Segment `json:",omitempty"`
// contains filtered or unexported fields
}
TableInfo represents one table information.
type UpdatePlan ¶
type UpdatePlan struct {
// raw query
RawQuery string
// mode
ReqMode xcontext.RequestMode
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
UpdatePlan represents delete plan
func NewUpdatePlan ¶
func NewUpdatePlan(log *xlog.Log, database string, query string, node *sqlparser.Update, router *router.Router) *UpdatePlan
NewUpdatePlan used to create UpdatePlan
func (*UpdatePlan) Build ¶
func (p *UpdatePlan) Build() error
Build used to build distributed querys.
func (*UpdatePlan) Children ¶
func (p *UpdatePlan) Children() *PlanTree
Children returns the children of the plan.