common

package module
v0.0.0-...-d78b96f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2017 License: MIT Imports: 2 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AlterAddInst

type AlterAddInst struct {
	// contains filtered or unexported fields
}

AlterAddInst represents an alter add instruction.

func NewAlterAddInst

func NewAlterAddInst(tableColumnDefiners TableColumnDefiner) *AlterAddInst

NewAlterAddInst returns an instance of an AlterAddInst

type AlterCommand

type AlterCommand struct {
	// contains filtered or unexported fields
}

AlterCommand represents an alter statement.

func NewAlterCommand

func NewAlterCommand(tableName string, instruction interface{}) *AlterCommand

NewAlterCommand returns an instance of an AlterCommand

type AlterDropInst

type AlterDropInst struct {
	// contains filtered or unexported fields
}

AlterDropInst represents an alter drop instruction.

func NewAlterDropInst

func NewAlterDropInst(tableName string) *AlterDropInst

NewAlterDropInst returns an instance of an AlterDropInst

type AlterModifyInst

type AlterModifyInst struct {
	// contains filtered or unexported fields
}

AlterModifyInst represents an modify add instruction.

func NewAlterModifyInst

func NewAlterModifyInst(tableColumnDefiners TableColumnDefiner) *AlterModifyInst

NewAlterModifyInst returns an instance of an AlterModifyInst

type AndCommon

type AndCommon struct {
	// contains filtered or unexported fields
}

func NewAndCommon

func NewAndCommon(value Expression, expression Expression) *AndCommon

func (AndCommon) Evaluate

func (a AndCommon) Evaluate(symbols map[string]interface{}) interface{}

type AssignmentCommon

type AssignmentCommon struct {
	// contains filtered or unexported fields
}

func NewAssignmentCommon

func NewAssignmentCommon(value string, expression Expression) *AssignmentCommon

type BetweenCommon

type BetweenCommon struct {
	// contains filtered or unexported fields
}

func NewBetweenCommon

func NewBetweenCommon(value Expression, expression Expression) *BetweenCommon

func (BetweenCommon) Evaluate

func (b BetweenCommon) Evaluate(symbols map[string]interface{}) interface{}

type BoolCommon

type BoolCommon struct {
	// contains filtered or unexported fields
}

func NewBoolCommon

func NewBoolCommon(value bool) *BoolCommon

func (BoolCommon) Evaluate

func (b BoolCommon) Evaluate(symbols map[string]interface{}) interface{}

type BooleanTableColumn

type BooleanTableColumn struct {
	// contains filtered or unexported fields
}

BooleanTableColumn represents the definition of a boolean table column.

func NewBooleanTableColumn

func NewBooleanTableColumn(columnName string, defaultValue interface{}, nullable, autoincrementable bool, primaryKey bool, foreignKey bool) BooleanTableColumn

NewBooleanTableColumn creates an instance of BooleanTableColumn.

func (BooleanTableColumn) Autoincrementable

func (c BooleanTableColumn) Autoincrementable() bool

func (BooleanTableColumn) ColumnName

func (c BooleanTableColumn) ColumnName() string

func (BooleanTableColumn) DefaultValue

func (c BooleanTableColumn) DefaultValue() interface{}

func (BooleanTableColumn) ForeignKey

func (c BooleanTableColumn) ForeignKey() bool

func (BooleanTableColumn) Nullable

func (c BooleanTableColumn) Nullable() bool

func (BooleanTableColumn) PrimaryKey

func (c BooleanTableColumn) PrimaryKey() bool

type CharTableColumn

type CharTableColumn struct {
	// contains filtered or unexported fields
}

CharTableColumn represents the definition of a char table column.

func NewCharTableColumn

func NewCharTableColumn(columnName string, defaultValue interface{}, nullable, autoincrementable bool, primaryKey bool, foreignKey bool, size uint16) CharTableColumn

NewCharTableColumn creates an instance of CharTableColumn.

func (CharTableColumn) Autoincrementable

func (c CharTableColumn) Autoincrementable() bool

func (CharTableColumn) ColumnName

func (c CharTableColumn) ColumnName() string

func (CharTableColumn) DefaultValue

func (c CharTableColumn) DefaultValue() interface{}

func (CharTableColumn) ForeignKey

func (c CharTableColumn) ForeignKey() bool

func (CharTableColumn) Nullable

func (c CharTableColumn) Nullable() bool

func (CharTableColumn) PrimaryKey

func (c CharTableColumn) PrimaryKey() bool

func (CharTableColumn) Size

func (c CharTableColumn) Size() uint16

Size returns the amount of bytes the char table column will consume.

type Command

type Command struct {
	InstructionType
	Instruction
	// contains filtered or unexported fields
}

Command contains information about the instruction type and the instruction itself.

func NewCommand

func NewCommand(tableModifier tableModifier, instructionType InstructionType, instruction Instruction) Command

func (Command) String

func (c Command) String() string

type CreateTableCommand

type CreateTableCommand struct {
	// contains filtered or unexported fields
}

CreateTableCommand represents a table creation statement.

func NewCreateTableCommand

func NewCreateTableCommand(tableName string, tableColumnDefiners TableColumnDefiners) *CreateTableCommand

NewCreateTableCommand creates an instance of CreateTableCommand.

func (CreateTableCommand) TableColumnDefiners

func (c CreateTableCommand) TableColumnDefiners() TableColumnDefiners

TableColumnDefiners returns all column definitions of the table.

func (CreateTableCommand) TableName

func (c CreateTableCommand) TableName() string

TableName returns the name of the table to be created.

type DatetimeTableColumn

type DatetimeTableColumn struct {
	// contains filtered or unexported fields
}

DatetimeTableColumn repesents the definition of a datetime table column.

func NewDatetimeTableColumn

func NewDatetimeTableColumn(columnName string, defaultValue interface{}, nullable, autoincrementable bool, primaryKey bool, foreignKey bool) DatetimeTableColumn

NewDatetimeTableColumn creates an instance of DatetimeTableColumn.

func (DatetimeTableColumn) Autoincrementable

func (c DatetimeTableColumn) Autoincrementable() bool

func (DatetimeTableColumn) ColumnName

func (c DatetimeTableColumn) ColumnName() string

func (DatetimeTableColumn) DefaultValue

func (c DatetimeTableColumn) DefaultValue() interface{}

func (DatetimeTableColumn) ForeignKey

func (c DatetimeTableColumn) ForeignKey() bool

func (DatetimeTableColumn) Nullable

func (c DatetimeTableColumn) Nullable() bool

func (DatetimeTableColumn) PrimaryKey

func (c DatetimeTableColumn) PrimaryKey() bool

type DeleteCommand

type DeleteCommand struct {
	// contains filtered or unexported fields
}

func NewDeleteTableCommand

func NewDeleteTableCommand(tableName string, alias string, where Expression) *DeleteCommand

func (DeleteCommand) Condition

func (c DeleteCommand) Condition() Expression

func (DeleteCommand) TableName

func (c DeleteCommand) TableName() string

type DivCommon

type DivCommon struct {
	// contains filtered or unexported fields
}

func NewDivCommon

func NewDivCommon(value Expression, expression Expression) *DivCommon

func (DivCommon) Evaluate

func (d DivCommon) Evaluate(symbols map[string]interface{}) interface{}

type DropCommand

type DropCommand struct {
	// contains filtered or unexported fields
}

DropCommand represents an drop statement.

func NewDropCommand

func NewDropCommand(tableName string) *DropCommand

NewDropCommand returns an instance of an DropCommand

func (DropCommand) TableName

func (i DropCommand) TableName() string

TableName returns the name of the table in which the values will be inserted.

type EqCommon

type EqCommon struct {
	// contains filtered or unexported fields
}

func NewEqCommon

func NewEqCommon(value Expression, expression Expression) *EqCommon

func (EqCommon) Evaluate

func (e EqCommon) Evaluate(symbols map[string]interface{}) interface{}

type Expression

type Expression interface {
	Evaluate(symbols map[string]interface{}) interface{}
}

type FalseCommon

type FalseCommon struct {
}

func NewFalseCommon

func NewFalseCommon() *FalseCommon

func (FalseCommon) Evaluate

func (f FalseCommon) Evaluate(symbols map[string]interface{}) interface{}

type FloatCommon

type FloatCommon struct {
	// contains filtered or unexported fields
}

func NewFloatCommon

func NewFloatCommon(value float64) *FloatCommon

func (FloatCommon) Evaluate

func (f FloatCommon) Evaluate(symbols map[string]interface{}) interface{}

type FloatTableColumn

type FloatTableColumn struct {
	// contains filtered or unexported fields
}

FloatTableColumn represents the definition of an float table column.

func NewFloatTableColumn

func NewFloatTableColumn(columnName string, defaultValue interface{}, nullable, autoincrementable bool, primaryKey bool, foreignKey bool) FloatTableColumn

NewFloatTableColumn creates an instance of FloatTableColumn.

func (FloatTableColumn) Autoincrementable

func (c FloatTableColumn) Autoincrementable() bool

func (FloatTableColumn) ColumnName

func (c FloatTableColumn) ColumnName() string

func (FloatTableColumn) DefaultValue

func (c FloatTableColumn) DefaultValue() interface{}

func (FloatTableColumn) ForeignKey

func (c FloatTableColumn) ForeignKey() bool

func (FloatTableColumn) Nullable

func (c FloatTableColumn) Nullable() bool

func (FloatTableColumn) PrimaryKey

func (c FloatTableColumn) PrimaryKey() bool

type GroupBySelect

type GroupBySelect struct {
	// contains filtered or unexported fields
}

func NewGroupBySelect

func NewGroupBySelect(table string, column string) *GroupBySelect

NewTableColumnSelector creates an instance of a TableColumnSelector.

type GtCommon

type GtCommon struct {
	// contains filtered or unexported fields
}

func NewGtCommon

func NewGtCommon(value Expression, expression Expression) *GtCommon

func (GtCommon) Evaluate

func (gt GtCommon) Evaluate(symbols map[string]interface{}) interface{}

type GteCommon

type GteCommon struct {
	// contains filtered or unexported fields
}

func NewGteCommon

func NewGteCommon(value Expression, expression Expression) *GteCommon

func (GteCommon) Evaluate

func (gte GteCommon) Evaluate(symbols map[string]interface{}) interface{}

type IdCommon

type IdCommon struct {
	// contains filtered or unexported fields
}

func NewIdCommon

func NewIdCommon(tableName string, alias string) *IdCommon

func (IdCommon) Evaluate

func (id IdCommon) Evaluate(symbols map[string]interface{}) interface{}

type InsertCommand

type InsertCommand struct {
	// contains filtered or unexported fields
}

InsertCommand represents an insert statement.

func NewInsertCommand

func NewInsertCommand(tableName string, values map[string]interface{}) *InsertCommand

NewInsertCommand returns an instance of an InsertCommand.

func (InsertCommand) TableName

func (i InsertCommand) TableName() string

TableName returns the name of the table in which the values will be inserted.

func (InsertCommand) Values

func (i InsertCommand) Values() map[string]interface{}

Values returns a map in which the keys are the columns in which the values will be inserted.

type Instruction

type Instruction func()

Instruction executes the command.

type InstructionType

type InstructionType int

InstructionType is used to determine the type of the instruction.

const (
	Create InstructionType = iota
	Select
	Update
	Insert
	Delete
	Drop
	Alter
)

Instruction type constants.

func (InstructionType) String

func (i InstructionType) String() string

type IntCommon

type IntCommon struct {
	// contains filtered or unexported fields
}

func NewIntCommon

func NewIntCommon(value int64) *IntCommon

func (IntCommon) Evaluate

func (i IntCommon) Evaluate(symbols map[string]interface{}) interface{}

type IntegerTableColumn

type IntegerTableColumn struct {
	// contains filtered or unexported fields
}

IntegerTableColumn represents the definition of an integer table column.

func NewIntegerTableColumn

func NewIntegerTableColumn(columnName string, defaultValue interface{}, nullable, autoincrementable bool, primaryKey bool, foreignKey bool) IntegerTableColumn

NewIntegerTableColumn creates an instance of IntegerTableColumn.

func (IntegerTableColumn) Autoincrementable

func (c IntegerTableColumn) Autoincrementable() bool

func (IntegerTableColumn) ColumnName

func (c IntegerTableColumn) ColumnName() string

func (IntegerTableColumn) DefaultValue

func (c IntegerTableColumn) DefaultValue() interface{}

func (IntegerTableColumn) ForeignKey

func (c IntegerTableColumn) ForeignKey() bool

func (IntegerTableColumn) Nullable

func (c IntegerTableColumn) Nullable() bool

func (IntegerTableColumn) PrimaryKey

func (c IntegerTableColumn) PrimaryKey() bool

type JoinSelect

type JoinSelect struct {
	// contains filtered or unexported fields
}

func NewJoinSelect

func NewJoinSelect(targetTable string, targetAlias string, filterCriteria Expression) *JoinSelect

func (JoinSelect) FilterCriteria

func (j JoinSelect) FilterCriteria() Expression

func (JoinSelect) TargetTable

func (j JoinSelect) TargetTable() string

type LikeCommon

type LikeCommon struct {
	// contains filtered or unexported fields
}

func NewLikeCommon

func NewLikeCommon(value Expression, expression Expression) *LikeCommon

func (LikeCommon) Evaluate

func (l LikeCommon) Evaluate(symbols map[string]interface{}) interface{}

type LtCommon

type LtCommon struct {
	// contains filtered or unexported fields
}

func NewLtCommon

func NewLtCommon(value Expression, expression Expression) *LtCommon

func (LtCommon) Evaluate

func (lt LtCommon) Evaluate(symbols map[string]interface{}) interface{}

type LteCommon

type LteCommon struct {
	// contains filtered or unexported fields
}

func NewLteCommon

func NewLteCommon(value Expression, expression Expression) *LteCommon

func (LteCommon) Evaluate

func (lte LteCommon) Evaluate(symbols map[string]interface{}) interface{}

type MultCommon

type MultCommon struct {
	// contains filtered or unexported fields
}

func NewMultCommon

func NewMultCommon(value Expression, expression Expression) *MultCommon

func (MultCommon) Evaluate

func (m MultCommon) Evaluate(symbols map[string]interface{}) interface{}

type NeCommon

type NeCommon struct {
	// contains filtered or unexported fields
}

func NewNeCommon

func NewNeCommon(value Expression, expression Expression) *NeCommon

func (NeCommon) Evaluate

func (ne NeCommon) Evaluate(symbols map[string]interface{}) interface{}

type NotCommon

type NotCommon struct {
	// contains filtered or unexported fields
}

func NewNotCommon

func NewNotCommon(value Expression) *NotCommon

func (NotCommon) Evaluate

func (n NotCommon) Evaluate(symbols map[string]interface{}) interface{}

type NullCommon

type NullCommon struct {
}

func NewNullCommon

func NewNullCommon() *NullCommon

func (NullCommon) Evaluate

func (n NullCommon) Evaluate(symbols map[string]interface{}) interface{}

type OrCommon

type OrCommon struct {
	// contains filtered or unexported fields
}

func NewOrCommon

func NewOrCommon(value Expression, expression Expression) *OrCommon

func (OrCommon) Evaluate

func (o OrCommon) Evaluate(symbols map[string]interface{}) interface{}

type SelectTableCommand

type SelectTableCommand struct {
	// contains filtered or unexported fields
}

SelectTableCommand represents a select from table query.

func NewSelectTableCommand

func NewSelectTableCommand(tableName string, mainAlias string, tableColumnSelectors TableColumnSelectors, joinList []JoinSelect, whereExpression Expression, groupBy []GroupBySelect) *SelectTableCommand

NewSelectTableCommand returns an instance of SelectTableCommand.

func (SelectTableCommand) Condition

func (s SelectTableCommand) Condition() Expression

func (SelectTableCommand) Joins

func (s SelectTableCommand) Joins() []JoinSelect

func (SelectTableCommand) ProjectedColumns

func (s SelectTableCommand) ProjectedColumns() TableColumnSelectors

func (SelectTableCommand) TableName

func (s SelectTableCommand) TableName() string

SourceTable returns the sourceTable of the table in which the values will be inserted.

type StringCommon

type StringCommon struct {
	// contains filtered or unexported fields
}

func NewStringCommon

func NewStringCommon(value string) *StringCommon

func (StringCommon) Evaluate

func (s StringCommon) Evaluate(symbols map[string]interface{}) interface{}

type SubCommon

type SubCommon struct {
	// contains filtered or unexported fields
}

func NewSubCommon

func NewSubCommon(value Expression, expression Expression) *SubCommon

func (SubCommon) Evaluate

func (s SubCommon) Evaluate(symbols map[string]interface{}) interface{}

type SumCommon

type SumCommon struct {
	// contains filtered or unexported fields
}

func NewSumCommon

func NewSumCommon(value Expression, expression Expression) *SumCommon

func (SumCommon) Evaluate

func (s SumCommon) Evaluate(symbols map[string]interface{}) interface{}

type TableColumnDefiner

type TableColumnDefiner interface {
	ColumnName() string
	DefaultValue() interface{}
	Nullable() bool
	Autoincrementable() bool
	PrimaryKey() bool
	ForeignKey() bool
}

TableColumnDefiner defines a column of the table to be created.

type TableColumnDefiners

type TableColumnDefiners []TableColumnDefiner

TableColumnDefiners is an array of TableColumnDefiner

type TableColumnSelector

type TableColumnSelector struct {
	// contains filtered or unexported fields
}

TableColumnSelector represents a selected column in a select query.

func NewTableColumnSelector

func NewTableColumnSelector(isStar bool, prefix string, columnName string, alias string, function interface{}) *TableColumnSelector

NewTableColumnSelector creates an instance of a TableColumnSelector.

func (TableColumnSelector) Alias

func (s TableColumnSelector) Alias() (string, bool)

Alias returns the column alias and returns true if it isn't empty.

func (TableColumnSelector) ColumnName

func (s TableColumnSelector) ColumnName() string

ColumnName returns the name of the selected column in a select query.

func (TableColumnSelector) Prefix

func (s TableColumnSelector) Prefix() (string, bool)

Prefix returns the column prefix and returns true if it isn't empty.

type TableColumnSelectors

type TableColumnSelectors []interface{}

TableColumnSelectors is an array of TableColumnSelector and TableColumnStarSelector.

type TableColumnStarSelector

type TableColumnStarSelector struct {
}

TableColumnStarSelector represents a star selector in a select query.

func NewTableColumnStarSelector

func NewTableColumnStarSelector() *TableColumnStarSelector

NewTableColumnStarSelector creates an instance of TableColumnStarSelector.

type TrueCommon

type TrueCommon struct {
}

func NewTrueCommon

func NewTrueCommon() *TrueCommon

func (TrueCommon) Evaluate

func (t TrueCommon) Evaluate(symbols map[string]interface{}) interface{}

type UpdateTableCommand

type UpdateTableCommand struct {
	// contains filtered or unexported fields
}

func NewUpdateTableCommand

func NewUpdateTableCommand(tableName string, assignments []*AssignmentCommon, where Expression) *UpdateTableCommand

func (UpdateTableCommand) Assignments

func (c UpdateTableCommand) Assignments() []*AssignmentCommon

func (UpdateTableCommand) Condition

func (c UpdateTableCommand) Condition() Expression

func (UpdateTableCommand) TableName

func (c UpdateTableCommand) TableName() string

func (UpdateTableCommand) Values

func (c UpdateTableCommand) Values(symbols map[string]interface{}) map[string]interface{}

Jump to

Keyboard shortcuts

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