Documentation ¶
Index ¶
- Constants
- func GetTableName(v vitesssp.TableExpr) (string, error)
- type AccessMode
- type AndExpr
- type Begin
- type Characteristic
- type ColName
- type Column
- func NewBigIntColumnWithValue(val interface{}) (*Column, error)
- func NewBinaryColumnWithValue(val interface{}) (*Column, error)
- func NewColumn() *Column
- func NewColumnWithColumnDefinition(column *vitesssp.ColumnDefinition) *Column
- func NewColumnWithName(name string) *Column
- func NewColumnWithNameAndType(name string, t ColumnType) *Column
- func NewColumnWithNameAndValue(name string, val interface{}) (*Column, error)
- func NewColumnWithTypeAndValue(typ ColumnType, val interface{}) (*Column, error)
- func NewColumnWithValue(val interface{}) (*Column, error)
- func NewDateColumnWithValue(val interface{}) (*Column, error)
- func NewDatetimeColumnWithValue(val interface{}) (*Column, error)
- func NewDoubleColumnWithValue(val interface{}) (*Column, error)
- func NewFloatColumnWithValue(val interface{}) (*Column, error)
- func NewIntegerColumnWithValue(val interface{}) (*Column, error)
- func NewNullColumn() *Column
- func NewShortIntColumnWithValue(val interface{}) (*Column, error)
- func NewTextColumnWithValue(val interface{}) (*Column, error)
- func NewTimeColumnWithValue(val interface{}) (*Column, error)
- func NewTimestampColumnWithValue(val interface{}) (*Column, error)
- func NewTinyIntColumnWithValue(val interface{}) (*Column, error)
- func (col *Column) Equals(other *Column) bool
- func (col *Column) ForValue(t SQLType) (vitessst.Value, error)
- func (col *Column) Name() string
- func (col *Column) SetName(name string)
- func (col *Column) SetValue(val interface{}) error
- func (col *Column) String() string
- func (col *Column) ToValue() (vitessst.Value, error)
- func (col *Column) Type() ColumnType
- func (col *Column) Value() interface{}
- type ColumnDefinition
- type ColumnType
- type Columns
- func (cols *Columns) AddColumn(col *Column)
- func (cols *Columns) AddColumns(columns []*Column)
- func (cols *Columns) AllColumns() []*Column
- func (cols *Columns) Clear()
- func (cols *Columns) ColumnAt(n int) (*Column, bool)
- func (cols *Columns) ColumnByName(name string) (*Column, bool)
- func (cols *Columns) Columns() []*Column
- func (cols *Columns) Equals(otherCols *Columns) bool
- func (cols *Columns) HasColumn(name string) bool
- func (cols *Columns) IsAllColumn() bool
- func (cols *Columns) Size() int
- func (cols *Columns) String() string
- type Commit
- type ComparisonExpr
- type Condition
- type DBDDL
- type DDL
- type Database
- type Delete
- type Explain
- type Expr
- type Field
- type IndexDefinition
- type Insert
- type IsolationLevel
- type Limit
- type Literal
- type NotExpr
- type OrExpr
- type Order
- type OrderBy
- type Parser
- type RangeCond
- type Rollback
- type Row
- type Rows
- type SQLType
- type SQLVal
- type Schema
- type Select
- type SelectStatement
- type Set
- type SetTransaction
- type Show
- type Statement
- type StatementType
- type Stream
- type Table
- type Tables
- type Union
- type Update
- type UpdateExprs
- type Use
- type ValTuple
- type ValType
- type Value
- type XorExpr
Constants ¶
const ( NotPrimaryKey = -1 SinglePrimaryKey = 0 )
const ( StmtSelect = vitesssp.StmtSelect StmtStream = vitesssp.StmtStream StmtInsert = vitesssp.StmtInsert StmtReplace = vitesssp.StmtReplace StmtUpdate = vitesssp.StmtUpdate StmtDelete = vitesssp.StmtDelete StmtDDL = vitesssp.StmtDDL StmtBegin = vitesssp.StmtBegin StmtCommit = vitesssp.StmtCommit StmtRollback = vitesssp.StmtRollback StmtSet = vitesssp.StmtSet StmtShow = vitesssp.StmtShow StmtUse = vitesssp.StmtUse StmtOther = vitesssp.StmtOther StmtUnknown = vitesssp.StmtUnknown StmtComment = vitesssp.StmtComment StmtPriv = vitesssp.StmtPriv )
These constants are used to identify the SQL statement type. Changing this list will require reviewing all calls to Preview.
const ( Unknown = -1 // NULL_TYPE specifies a NULL type. Null = vitessst.Null // INT8 specifies a TINYINT type. Int8 = vitessst.Int8 // UINT8 specifies a TINYINT UNSIGNED type. Uint8 = vitessst.Uint8 // INT16 specifies a SMALLINT type. Int16 = vitessst.Int16 // UINT16 specifies a SMALLINT UNSIGNED type. Uint16 = vitessst.Uint16 // INT24 specifies a MEDIUMINT type. Int24 = vitessst.Int24 // UINT24 specifies a MEDIUMINT UNSIGNED type. Uint24 = vitessst.Uint24 // INT32 specifies a INTEGER type. Int32 = vitessst.Int32 // UINT32 specifies a INTEGER UNSIGNED type. Uint32 = vitessst.Uint32 // INT64 specifies a BIGINT type. Int64 = vitessst.Int64 // UINT64 specifies a BIGINT UNSIGNED type. Uint64 = vitessst.Uint64 // FLOAT32 specifies a FLOAT type. Float32 = vitessst.Float32 // FLOAT64 specifies a DOUBLE or REAL type. Float64 = vitessst.Float64 // TIMESTAMP specifies a TIMESTAMP type. Timestamp = vitessst.Timestamp // DATE specifies a DATE type. Date = vitessst.Date // TIME specifies a TIME type. Time = vitessst.Time // DATETIME specifies a DATETIME type. Datetime = vitessst.Datetime // YEAR specifies a YEAR type. Year = vitessst.Year // DECIMAL specifies a DECIMAL or NUMERIC type. Decimal = vitessst.Decimal // TEXT specifies a TEXT type. Text = vitessst.Text // BLOB specifies a BLOB type. Blob = vitessst.Blob // VARCHAR specifies a VARCHAR type. VarChar = vitessst.VarChar // VARBINARY specifies a VARBINARY type. VarBinary = vitessst.VarBinary // CHAR specifies a CHAR type. Char = vitessst.Char // BINARY specifies a BINARY type. Binary = vitessst.Binary // BIT specifies a BIT type. Bit = vitessst.Bit // ENUM specifies an ENUM type. Enum = vitessst.Enum // SET specifies a SET type. SetType = vitessst.Set // GEOMETRY specifies a GEOMETRY type. Geometry = vitessst.Geometry // JSON specifies a JSON type. TypeJSON = vitessst.TypeJSON // EXPRESSION specifies a SQL expression. Expression = vitessst.Expression )
Vitess data types. These are idiomatically named synonyms for the vitess.Type values.
const ( StrVal = vitesssp.StrVal IntVal = vitesssp.IntVal FloatVal = vitesssp.FloatVal HexNum = vitesssp.HexNum HexVal = vitesssp.HexVal BitVal = vitesssp.BitVal )
const ( // NOTE: TestSchemaFindColumn checks whether ColKeyPrimary equals vt.sqlparser.colKeyPrimary // because it is an internal constant variable. ColKeyPrimary = vitesssp.ColumnKeyOption(1) )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Characteristic ¶
type Characteristic = vitesssp.Characteristic
Characteristic is a transaction related change.
type Column ¶
type Column struct {
// contains filtered or unexported fields
}
Column represents a column.
func NewBigIntColumnWithValue ¶
NewBigIntColumnWithValue returns a big int column with the specified value.
func NewBinaryColumnWithValue ¶
NewBinaryColumnWithValue returns a binary column with the specified value.
func NewColumnWithColumnDefinition ¶
func NewColumnWithColumnDefinition(column *vitesssp.ColumnDefinition) *Column
NewColumnWithColumnDefinition returns a column with the specified vitess column definition.
func NewColumnWithName ¶
NewColumnWithName returns a column with the specified name.
func NewColumnWithNameAndType ¶
func NewColumnWithNameAndType(name string, t ColumnType) *Column
NewColumnWithNameAndType returns a column with the specified name and type.
func NewColumnWithNameAndValue ¶
NewColumnWithNameAndValue returns a column with the specified name and value.
func NewColumnWithTypeAndValue ¶
func NewColumnWithTypeAndValue(typ ColumnType, val interface{}) (*Column, error)
NewColumnWithTypeAndValue returns a column with the specified type and value.
func NewColumnWithValue ¶
NewColumnWithValue returns a column with the specified value.
func NewDateColumnWithValue ¶
NewDateColumnWithValue returns a date column with the specified value.
func NewDatetimeColumnWithValue ¶
NewDatetimeColumnWithValue returns a date column with the specified value.
func NewDoubleColumnWithValue ¶
NewDoubleColumnWithValue returns a double column with the specified value.
func NewFloatColumnWithValue ¶
NewFloatColumnWithValue returns a float column with the specified value.
func NewIntegerColumnWithValue ¶
NewIntegerColumnWithValue returns an integer column with the specified value.
func NewShortIntColumnWithValue ¶
NewShortIntColumnWithValue returns a short int column with the specified value.
func NewTextColumnWithValue ¶
NewTextColumnWithValue returns a text column with the specified value.
func NewTimeColumnWithValue ¶
NewTimeColumnWithValue returns a time column with the specified value.
func NewTimestampColumnWithValue ¶
NewTimestampColumnWithValue returns a timestamp column with the specified value.
func NewTinyIntColumnWithValue ¶
NewTinyIntColumnWithValue returns a tiny int column with the specified value.
func (*Column) Equals ¶
Equals returns true when the specified column is equals to this column, otherwise false.
func (*Column) ForValue ¶ added in v1.0.5
ForValue converts a column to a vitess value for the specified SQL type.
type ColumnDefinition ¶
type ColumnDefinition = vitesssp.ColumnDefinition
ColumnDefinition describes a column in a CREATE TABLE statement.
type ColumnType ¶
Type defines the various supported data types in bind vars and query results.
type Columns ¶
type Columns struct {
// contains filtered or unexported fields
}
Columns represents a column array.
func NewColumnsWithColumns ¶
NewColumnsWithColumns returns a columns with the specified columns.
func (*Columns) AddColumns ¶
AddColumns adds columns.
func (*Columns) AllColumns ¶
AllColumns returns the all columns.
func (*Columns) ColumnByName ¶
ColumnByName returns a column by the specified name.
func (*Columns) Equals ¶
Equals returns true when the specified columns are equals to this columns, otherwise false.
func (*Columns) IsAllColumn ¶
IsAllColumn returns true when the query has only "*" column.
type ComparisonExpr ¶
type ComparisonExpr = vitesssp.ComparisonExpr
ComparisonExpr represents a two-value comparison expression.
type DBDDL ¶
type DBDDL = vitesssp.DBDDLStatement
DBDDL represents a CREATE, DROP, or ALTER database statement.
type DDL ¶
type DDL = vitesssp.DDLStatement
DDL represents a CREATE, ALTER, DROP, RENAME, TRUNCATE or ANALYZE statement.
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a destination or source database of query.
func NewDatabaseWithDBDDL ¶
NewDatabaseWithDBDDL returns a new database with the specified DBDDL.
func NewDatabaseWithName ¶
NewDatabaseWithName returns a new database with the specified string.
func (*Database) IfNotExists ¶
IfNotExists returns true when the IF NOT EXISTS option is enabled.
type Delete ¶
Delete represents a DELETE statement.
func NewDeleteWithDelete ¶
NewDeleteWithDelete creates a delete statement from the raw query.
func NewDeleteWithName ¶
NewDeleteWithName creates a delete statement from the table name.
type IndexDefinition ¶ added in v0.9.2
type IndexDefinition = vitesssp.IndexDefinition
IndexDefinition describes an index in a CREATE TABLE statement.
type Insert ¶
Insert represents an INSERT or REPLACE statement.
func NewInsertWithInsert ¶
NewInsertWithInsert creates a insert statement from the raw query.
type IsolationLevel ¶
type IsolationLevel = vitesssp.IsolationLevel
IsolationLevel is self-explanatory in this context.
type Row ¶
type Row struct {
*Columns
}
Row represents a row object which includes query execution results.
func NewRowWithColumns ¶
NewRowWithColumns return a row instance with the specified columns.
func NewRowWithInsert ¶
NewRowWithInsert return a row instance with the specified INSERT statement.
func (*Row) Equals ¶
Equals returns true when the specified row is equals to this row, otherwise false.
func (*Row) HasMatchedColumn ¶
HasMatchedColumn returns true when the row has the specified column, otherwise false.
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows represents a row array.
func NewRowsWithRows ¶
NewRowsWithRows returns a row array with the specified rows.
func (*Rows) FindMatchedRows ¶
FindMatchedRows returns only matched rows by the specified condition.
type SQLType ¶ added in v1.0.5
type SQLType = vitessstpq.Type
SQLType defines the various supported data types in bind vars.
type Schema ¶
type Schema struct {
DDL
}
Schema represents a table schema.
func NewSchemaWithDDL ¶
NewSchemaWithDDL returns a schema with the specified DDL.
func NewSchemaWithName ¶
NewSchemaWithName returns a schema with the specified table name.
func (*Schema) FindColumn ¶
func (schema *Schema) FindColumn(name string) (*ColumnDefinition, bool)
FindColumn returns the specified columns definition.
func (*Schema) FindPrimaryColumn ¶
func (schema *Schema) FindPrimaryColumn() (*ColumnDefinition, bool)
FindPrimaryColumn returns the specified columns definition.
type Select ¶
Select represents an SELECT statement.
func NewSelectWithSelect ¶
NewSelectWithSelect creates a select statement from the raw query.
type SelectStatement ¶
type SelectStatement = vitesssp.SelectStatement
SelectStatement any SELECT statement.
type SetTransaction ¶
type SetTransaction = vitesssp.SetTransaction
SetTransaction represents a SET TRANSACTION statement.
type StatementType ¶
type StatementType = vitesssp.StatementType
StatementType encodes the type of a SQL statement.
type Table ¶
Table represents a destination or source database of query.
func NewTableWitExpr ¶
NewTableWitExpr returns a table with the specified expression.
type Tables ¶
type Tables = []*Table
Tables represents a table array.
func NewTablesWitExprs ¶
func NewTablesWitExprs(exprs vitesssp.TableExprs) Tables
NewTablesWitExprs returns a tables with the specified expressions.
type Update ¶
Update represents an INSERT or REPLACE statement.
func NewUpdateWithUpdate ¶
NewUpdateWithUpdate creates a insert statement from the raw query.
type UpdateExprs ¶
type UpdateExprs = vitesssp.UpdateExprs
UpdateExprs represents a list of update expressions.
type Value ¶
type Value struct {
// contains filtered or unexported fields
}
Value represents a query value.
func NewValueWith ¶ added in v0.9.2
NewValueWith creates a query value with the specified type.