Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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. In our sql syntax in sql.y, alter will be changed to rename in case next: ALTER ignore_opt TABLE table_name RENAME to_opt table_name
{
Change this to a rename statement
$$ = &DDL{Action: RenameStr, Table: $4, NewName: $7}
}
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.
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.
type OthersPlan ¶ added in v1.0.6
type OthersPlan struct {
// raw query
RawQuery string
// mode
ReqMode xcontext.RequestMode
// query and backend tuple
Querys []xcontext.QueryTuple
// contains filtered or unexported fields
}
OthersPlan -- represents a special plan.
func NewOthersPlan ¶ added in v1.0.6
func NewOthersPlan(log *xlog.Log, database string, query string, node sqlparser.Statement, router *router.Router) *OthersPlan
NewOthersPlan -- used to create OthersPlan.
func (*OthersPlan) Build ¶ added in v1.0.6
func (p *OthersPlan) Build() error
Build used to build distributed querys.
func (*OthersPlan) JSON ¶ added in v1.0.6
func (p *OthersPlan) JSON() string
JSON returns the plan info.
func (*OthersPlan) Size ¶ added in v1.0.6
func (p *OthersPlan) Size() int
Size returns the memory size.
func (*OthersPlan) Type ¶ added in v1.0.6
func (p *OthersPlan) Type() PlanType
Type returns the type of the plan.
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" // PlanTypeUnion enum. PlanTypeUnion PlanType = "PlanTypeUnion" // PlanTypeOthers enum. PlanTypeOthers PlanType = "PlanTypeOthers" )
type SelectPlan ¶
type SelectPlan struct {
// raw query
RawQuery string
Root builder.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.
type UnionPlan ¶ added in v1.0.7
type UnionPlan struct {
// raw query
RawQuery string
Root builder.PlanNode
// contains filtered or unexported fields
}
UnionPlan represents union plan.
func NewUnionPlan ¶ added in v1.0.7
func NewUnionPlan(log *xlog.Log, database string, query string, node *sqlparser.Union, router *router.Router) *UnionPlan
NewUnionPlan used to create SelectPlan.
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 update 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.