rsets

package
Version: v0.0.0-...-7f9930a Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2015 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAggFields

func GetAggFields(fields []*field.Field) map[int]struct{}

GetAggFields gets aggregate fields position map.

func HasAggFields

func HasAggFields(fields []*field.Field) bool

HasAggFields checks whether has aggregate field.

Types

type DistinctRset

type DistinctRset struct {
	Src        plan.Plan
	SelectList *plans.SelectList
}

DistinctRset is record set for distinct fields.

func (*DistinctRset) Plan

func (r *DistinctRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets DistinctDefaultPlan.

type FieldRset

type FieldRset struct {
	Fields []*field.Field
}

FieldRset is Recordset for select expression, like `select 1, 1+1`.

func (*FieldRset) Plan

func (r *FieldRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets SelectExprPlan.

type GroupByRset

type GroupByRset struct {
	By         []expression.Expression
	Src        plan.Plan
	SelectList *plans.SelectList
}

GroupByRset is record set for group by fields.

func (*GroupByRset) HasAmbiguousField

func (r *GroupByRset) HasAmbiguousField(indices []int, fields []*field.Field) bool

HasAmbiguousField checks whether have ambiguous group by fields.

func (*GroupByRset) Plan

func (r *GroupByRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets GroupByDefaultPlan.

func (*GroupByRset) String

func (r *GroupByRset) String() string

type HavingRset

type HavingRset struct {
	Src  plan.Plan
	Expr expression.Expression
}

HavingRset is record set for having fields.

func (*HavingRset) CheckAndUpdateSelectList

func (r *HavingRset) CheckAndUpdateSelectList(selectList *plans.SelectList, groupBy []expression.Expression, tableFields []*field.ResultField) error

CheckAndUpdateSelectList checks having fields validity and set hidden fields to selectList.

func (*HavingRset) Plan

func (r *HavingRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets HavingPlan.

func (*HavingRset) String

func (r *HavingRset) String() string

String implements fmt.Stringer interface.

type JoinRset

type JoinRset struct {
	Left  interface{}
	Right interface{}
	Type  JoinType
	On    expression.Expression
	// contains filtered or unexported fields
}

JoinRset is record set for table join.

func (*JoinRset) Plan

func (r *JoinRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets JoinPlan.

func (*JoinRset) String

func (r *JoinRset) String() string

type JoinType

type JoinType int

JoinType is join type, including cross/left/right/full.

const (
	// CrossJoin is cross join type.
	CrossJoin JoinType = iota + 1
	// LeftJoin is left Join type.
	LeftJoin
	// RightJoin is right Join type.
	RightJoin
	// FullJoin is full Join type.
	FullJoin
)

func (JoinType) String

func (t JoinType) String() string

String gets string value of join type.

type LimitRset

type LimitRset struct {
	Count uint64
	Src   plan.Plan
}

LimitRset is record set for limit.

func (*LimitRset) Plan

func (r *LimitRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets LimitDefaultPlan.

func (*LimitRset) String

func (r *LimitRset) String() string

type OffsetRset

type OffsetRset struct {
	Count uint64
	Src   plan.Plan
}

OffsetRset is record set for limit offset.

func (*OffsetRset) Plan

func (r *OffsetRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets OffsetDefaultPlan.

func (*OffsetRset) String

func (r *OffsetRset) String() string

type OrderByItem

type OrderByItem struct {
	Expr expression.Expression
	Asc  bool
}

OrderByItem is order by item.

func (OrderByItem) String

func (i OrderByItem) String() string

type OrderByRset

type OrderByRset struct {
	By         []OrderByItem
	Src        plan.Plan
	SelectList *plans.SelectList
}

OrderByRset is record set for order by fields.

func (*OrderByRset) CheckAndUpdateSelectList

func (r *OrderByRset) CheckAndUpdateSelectList(selectList *plans.SelectList, tableFields []*field.ResultField) error

CheckAndUpdateSelectList checks order by fields validity and set hidden fields to selectList.

func (*OrderByRset) Plan

func (r *OrderByRset) Plan(ctx context.Context) (plan.Plan, error)

Plan get SrcPlan/OrderByDefaultPlan. If src is NullPlan or order by fields are empty, then gets SrcPlan. Default gets OrderByDefaultPlan.

func (*OrderByRset) String

func (r *OrderByRset) String() string

type Recordset

type Recordset struct {
	Ctx context.Context
	plan.Plan
}

Recordset implements rset.Recordset interface.

func (Recordset) Do

func (r Recordset) Do(f func(data []interface{}) (bool, error)) error

Do implements rset.Recordset.

func (Recordset) Fields

func (r Recordset) Fields() (fields []*field.ResultField, err error)

Fields implements rset.Recordset.

func (Recordset) FirstRow

func (r Recordset) FirstRow() (row []interface{}, err error)

FirstRow implements rset.Recordset.

func (Recordset) GetFields

func (r Recordset) GetFields() []interface{}

GetFields implements rset.Recordset.

func (Recordset) Rows

func (r Recordset) Rows(limit, offset int) ([][]interface{}, error)

Rows implements rset.Recordset.

type SelectFieldsRset

type SelectFieldsRset struct {
	Src        plan.Plan
	SelectList *plans.SelectList
}

SelectFieldsRset is record set to select fields.

func (*SelectFieldsRset) Plan

func (r *SelectFieldsRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets SrcPlan/SelectFieldsDefaultPlan. If all fields are equal to src plan fields, then gets SrcPlan. Default gets SelectFieldsDefaultPlan.

type SelectFinalRset

type SelectFinalRset struct {
	Src        plan.Plan
	SelectList *plans.SelectList
}

SelectFinalRset is record set to select final fields after where/group by/order by/... proccessing, like `select c1, c2 from t where c1 > 1`, SelectFinalRset gets c1 and c2 column data value after where condition filter.

func (*SelectFinalRset) Plan

func (r *SelectFinalRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets SelectFinalPlan.

type SelectLockRset

type SelectLockRset struct {
	Src  plan.Plan
	Lock coldef.LockType
}

SelectLockRset is record set for select for update.

func (*SelectLockRset) Plan

func (r *SelectLockRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets SelectLockPlan.

type ShowRset

type ShowRset struct {
	Target     int
	DBName     string
	TableName  string
	ColumnName string
	Flag       int
	Full       bool
}

ShowRset is record set to show.

func (*ShowRset) Plan

func (r *ShowRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets ShowPlan.

type TableRset

type TableRset struct {
	Schema string
	Name   string
}

TableRset is record set to select table, like `select c from t as at`.

func (*TableRset) Plan

func (r *TableRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets InfoSchemaPlan/TableDefaultPlan.

type TableSource

type TableSource struct {
	// Source is table.Ident or stmt.Statement.
	Source interface{}
	// Table source name.
	Name string
}

TableSource is table source or sub select.

func (*TableSource) String

func (t *TableSource) String() string

type UnionRset

type UnionRset struct {
	Srcs      []plan.Plan
	Distincts []bool
}

UnionRset is record set for union fields.

func (*UnionRset) Plan

func (r *UnionRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets UnionPlan.

type WhereRset

type WhereRset struct {
	Expr expression.Expression
	Src  plan.Plan
}

WhereRset is record set for where filter.

func (*WhereRset) Plan

func (r *WhereRset) Plan(ctx context.Context) (plan.Plan, error)

Plan gets NullPlan/FilterDefaultPlan.

Jump to

Keyboard shortcuts

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