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 DistinctPlan
- type InsertPlan
- type JoinPlan
- type LimitPlan
- type OrderBy
- type OrderByPlan
- type Plan
- type PlanTree
- type PlanType
- type SelectPlan
- 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, node *sqlparser.Select, tuples []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.
func (*DDLPlan) Children ¶
Children returns the children of the plan.
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 DistinctPlan ¶
type DistinctPlan struct { // type Typ PlanType // contains filtered or unexported fields }
DistinctPlan represents distinct plan.
func NewDistinctPlan ¶
func NewDistinctPlan(log *xlog.Log, node *sqlparser.Select) *DistinctPlan
NewDistinctPlan used to create DistinctPlan.
func (*DistinctPlan) Build ¶
func (p *DistinctPlan) Build() error
Build used to build distributed querys.
func (*DistinctPlan) Children ¶
func (p *DistinctPlan) Children() *PlanTree
Children returns the children of the plan.
func (*DistinctPlan) Type ¶
func (p *DistinctPlan) Type() PlanType
Type returns the type 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 JoinPlan ¶
type JoinPlan struct {
// contains filtered or unexported fields
}
JoinPlan represents join plan.
func NewJoinPlan ¶
NewJoinPlan used to create JoinPlan.
func (*JoinPlan) Children ¶
Children returns the children of the plan.
type LimitPlan ¶
LimitPlan represents order-by plan.
func NewLimitPlan ¶
NewLimitPlan used to create LimitPlan.
func (*LimitPlan) Children ¶
Children returns the children of the plan.
func (*LimitPlan) ReWritten ¶
ReWritten used to re-write the limit clause.
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) *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 Plan ¶
Plan interface.
type PlanTree ¶
type PlanTree struct {
// contains filtered or unexported fields
}
PlanTree is a container for all plans
func (*PlanTree) Add ¶
Add used to add new plan to the tree.
func (*PlanTree) Build ¶
Build used to build plans(we won't build sub-plans in this plan).
func (*PlanTree) Plans ¶
Plans returns all the plans of the tree.
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 // query and backend tuple Querys []xcontext.QueryTuple // 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 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.