Documentation
¶
Index ¶
- Constants
- Variables
- type AlterDatabase
- type AlterTable
- type AndExpr
- type Column
- type Columns
- type CompExpr
- type CompExprOperator
- type CreateDatabase
- type CreateIndex
- type CreateTable
- type Data
- type DataType
- type Database
- type Delete
- type DropDatabase
- type DropIndex
- type DropTable
- type Expr
- type IfExists
- type IfNotExists
- type Index
- type IndexType
- type Indexes
- type Insert
- type Literal
- type OrExpr
- type OrderType
- type Schema
- type Select
- type Statement
- type StatementList
- type StatementType
- type Table
- type Tables
- type Update
- type Where
Constants ¶
const ( UnknownData = iota BigIntData BinaryData BitData BlobData BooleanData CharData CharacterData ClobData DateData DecimalData DoubleData FloatData IntData IntegerData LongBlobData LongTextData MediumBlobData MediumIntData MediumTextData NumericData RealData SetData SmallIntData TextData TimeData TimeStampData TinyBlobData TinyIntData TinyTextData VarBinaryData VarCharData VarCharacterData YearData )
const ( CreateDatabaseStatement = iota CreateTableStatement CreateIndexStatement InsertStatement SelectStatement UpdateStatement DeleteStatement DropDatabaseStatement DropTableStatement DropIndexStatement AlterDatabaseStatement AlterTableStatement AlterIndexStatement )
Variables ¶
var ErrInvalidDataType = errors.New("invalid data type")
ErrInvalidDataType is returned when the data type is invalid.
var NullLiteral = NewLiteralWith(nil)
NullLiteral represents a null value.
Functions ¶
This section is empty.
Types ¶
type AlterDatabase ¶
type AlterDatabase struct {
*Database
}
AlterDatabase is a "ALTER DATABASE" statement.
func NewAlterDatabaseWith ¶
func NewAlterDatabaseWith(name string) *AlterDatabase
NewAlterDatabaseWith returns a new AlterDatabase statement instance with the specified options.
func (*AlterDatabase) StatementType ¶
func (stmt *AlterDatabase) StatementType() StatementType
StatementType returns the statement type.
func (*AlterDatabase) String ¶
func (stmt *AlterDatabase) String() string
String returns the statement string representation.
type AlterTable ¶
AlterTable is a "ALTER TABLE" statement.
func NewAlterTableWith ¶
func NewAlterTableWith(schemaName string, tblName string) *AlterTable
NewAlterTableWith returns a new AlterTable statement instance with the specified options.
func (*AlterTable) StatementType ¶
func (stmt *AlterTable) StatementType() StatementType
StatementType returns the statement type.
func (*AlterTable) String ¶
func (stmt *AlterTable) String() string
String returns the statement string representation.
type Column ¶
Column represents a column.
func NewColumnWith ¶
NewColumn returns a column instance.
func NewColumnWithName ¶
NewColumn returns a column instance.
type Columns ¶
type Columns []*Column
Columns represens a column array.
func NewColumnsWith ¶
NewColumnsWith returns a column array instance with the specified columns.
func (Columns) NameString ¶
NameString returns a string representation of the the colum names.
func (Columns) ValueString ¶
ValueString returns a string representation of the the colum values.
type CompExpr ¶
type CompExpr struct {
Operator CompExprOperator
Left *Column
Right *Literal
}
CompExpr represents an comparsion expression.
func NewCompExpr ¶
func NewCompExpr(op CompExprOperator, left *Column, right *Literal) *CompExpr
NewCompExpr returns a new CompExpr instance with the specified parameters.
type CompExprOperator ¶
type CompExprOperator uint8
CompExprOperator is an enum for CompExpr.Operator
const ( EqualOp CompExprOperator = iota NotEqualOp LessThanOp GreaterThanOp LessEqualOp GreaterEqualOp InOp NotInOp )
Constants for Enum Type - CompExprOperator
func (CompExprOperator) String ¶
func (t CompExprOperator) String() string
String returns the string representation.
type CreateDatabase ¶
type CreateDatabase struct {
*Database
*IfNotExists
}
CreateDatabase is a "CREATE DATABASE" statement.
func NewCreateDatabaseWith ¶
func NewCreateDatabaseWith(name string, ifne *IfNotExists) *CreateDatabase
NewCreateDatabaseWith returns a new CreateDatabase statement instance with the specified options.
func (*CreateDatabase) StatementType ¶
func (stmt *CreateDatabase) StatementType() StatementType
StatementType returns the statement type.
func (*CreateDatabase) String ¶
func (stmt *CreateDatabase) String() string
String returns the statement string representation.
type CreateIndex ¶
type CreateIndex struct {
*Schema
*IfNotExists
}
CreateIndex is a "CREATE INDEX" statement.
func NewCreateIndexWith ¶
func NewCreateIndexWith(schema *Schema, ifne *IfNotExists) *CreateIndex
NewCreateIndexWith returns a new CreateIndex statement instance with the specified parameters.
func (*CreateIndex) StatementType ¶
func (stmt *CreateIndex) StatementType() StatementType
StatementType returns the statement type.
func (*CreateIndex) String ¶
func (stmt *CreateIndex) String() string
String returns the statement string representation.
type CreateTable ¶
type CreateTable struct {
*Schema
*IfNotExists
}
CreateTable is a "CREATE TABLE" statement.
func NewCreateTableWith ¶
func NewCreateTableWith(schema *Schema, ifne *IfNotExists) *CreateTable
NewCreateTableWith returns a new CreateTable statement instance with the specified options.
func (*CreateTable) StatementType ¶
func (stmt *CreateTable) StatementType() StatementType
StatementType returns the statement type.
func (*CreateTable) String ¶
func (stmt *CreateTable) String() string
String returns the statement string representation.
type Data ¶
Data represents a data type.
func NewDataFrom ¶
NewDataFrom returns the data type of the specified string.
func NewDataWith ¶
NewDataWith returns a new DataType instance with the specified type and length.
func (*Data) DataLength ¶
DataLength returns the column data length.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a database.
func NewDatabaseWith ¶
NewDatabaseWith returns a new Database instance with the specified name.
type Delete ¶
Delete is a "DELETE" statement.
func NewDeleteWith ¶
NewDeleteWith returns a new Delete statement instance with the specified parameters.
func (*Delete) StatementType ¶
func (stmt *Delete) StatementType() StatementType
StatementType returns the statement type.
type DropDatabase ¶
DropDatabase is a "DROP DATABASE" statement.
func NewDropDatabaseWith ¶
func NewDropDatabaseWith(name string, ife *IfExists) *DropDatabase
NewDropDatabaseWith returns a new DropDatabase statement instance with the specified parameters.
func (*DropDatabase) StatementType ¶
func (stmt *DropDatabase) StatementType() StatementType
StatementType returns the statement type.
func (*DropDatabase) String ¶
func (stmt *DropDatabase) String() string
String returns the statement string representation.
type DropIndex ¶
DropIndex is a "DROP INDEX" statement.
func NewDropIndexWith ¶
NewDropIndexWith returns a new DropIndex statement instance with the specified parameters.
func (*DropIndex) StatementType ¶
func (stmt *DropIndex) StatementType() StatementType
StatementType returns the statement type.
type DropTable ¶
DropTable is a "DROP TABLE" statement.
func NewDropTableWith ¶
NewDropTableWith returns a new DropTable statement instance with the specified parameters.
func (*DropTable) StatementType ¶
func (stmt *DropTable) StatementType() StatementType
StatementType returns the statement type.
type Expr ¶
type Expr interface {
// String returns the index string representation.
String() string
}
Expr represents an expression.
type IfExists ¶
type IfExists struct {
// contains filtered or unexported fields
}
IfExists represents a IF EXISTS option.
func NewIfExistsWith ¶
NewIfExistsWith returns a new IfExists option instance.
type IfNotExists ¶
type IfNotExists struct {
// contains filtered or unexported fields
}
IfNotExists represents a IF NOT EXISTS option.
func NewIfNotExistsWith ¶
func NewIfNotExistsWith(v bool) *IfNotExists
NewIfNotExistsWith returns a new IfNotExists option instance.
func (*IfNotExists) Enabled ¶
func (opt *IfNotExists) Enabled() bool
Enabled returns true whether the option is enabled.
func (*IfNotExists) IfNotExists ¶
func (opt *IfNotExists) IfNotExists() bool
IfNotExists returns the IF NOT EXISTS option.
func (*IfNotExists) String ¶
func (opt *IfNotExists) String() string
String returns the string representation.
type Index ¶
type Index struct {
Columns
// contains filtered or unexported fields
}
Index represents a index.
func NewIndexWith ¶
NewIndexWith returns a new index instance.
func NewPrimaryIndexWith ¶
NewPrimaryIndexWith returns a new primary index instance.
func NewSecondaryIndexWith ¶
NewSecondaryIndexWith returns a new secondary index instance.
type Indexes ¶
type Indexes []*Index
Indexes represents an index array.
type Insert ¶
Insert is a "INSERT" statement.
func NewInsertWith ¶
NewInsertWith returns a new Insert statement instance with the specified parameters.
func (*Insert) StatementType ¶
func (stmt *Insert) StatementType() StatementType
StatementType returns the statement type.
type Literal ¶
type Literal struct {
// contains filtered or unexported fields
}
Literal represents a constant value.
func NewLiteralWith ¶
NewLiteralWith returns a new Literal instance with the specified value.
type Schema ¶
Schema represents a table schema.
func NewSchemaWith ¶
NewSchemaWith returns a new schema statement instance with the parameters.
type Select ¶
Select is a "SELECT" statement.
func NewSelectWith ¶
NewSelectWith returns a new Select statement instance with the specified parameters.
func (*Select) StatementType ¶
func (stmt *Select) StatementType() StatementType
StatementType returns the statement type.
type Statement ¶
type Statement interface {
// StatementType returns the statement type.
StatementType() StatementType
// String returns the statement string representation.
String() string
}
Statement represents a statement interface.
type StatementList ¶
type StatementList = []Statement
StatementList represents a statement list.
func NewStatementList ¶
func NewStatementList() StatementList
NewStatementList returns a new statement list.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a table.
func NewTableWith ¶
NewTableWith returns a new Table instance with the specified name.
type Tables ¶
type Tables []*Table
Tables represens a column array.
func NewTablesWith ¶
NewTablesWith returns a column array instance with the specified columns.
type Update ¶
Update is a "UPDATE" statement.
func NewUpdateWith ¶
NewUpdateWith returns a new Update statement instance with the specified parameters.
func (*Update) StatementType ¶
func (stmt *Update) StatementType() StatementType
StatementType returns the statement type.
type Where ¶
type Where struct {
// contains filtered or unexported fields
}
Where represents a where condition.
func NewWhereWith ¶
NewWhereWith returns a new where condition instance with the specified parameters.
Source Files
¶
- alter_database.go
- alter_table.go
- column.go
- columns.go
- create_database.go
- create_index.go
- create_table.go
- data_type.go
- database.go
- delete.go
- drop_database.go
- drop_index.go
- drop_table.go
- errors.go
- expr.go
- expr_cmp.go
- index.go
- indexes.go
- insert.go
- literal.go
- options.go
- order_type.go
- schema.go
- select.go
- statement.go
- statement_type.go
- table.go
- tables.go
- update.go
- where.go