Documentation ¶
Index ¶
Constants ¶
const ( LongVarBinary int LongVarChar GeometryCollection GeomCollection LineString MultiLineString MultiPoint MultiPolygon Point Polygon Json Geometry Enum Set Bit Time Timestamp DateTime Binary VarBinary Blob Year Decimal Dec Fixed Numeric Float Float4 Float8 Double Real TinyInt SmallInt MediumInt Int Integer BigInt MiddleInt Int1 Int2 Int3 Int4 Int8 Date TinyBlob MediumBlob LongBlob Bool Boolean Serial NVarChar NChar Char Character VarChar TinyText Text MediumText LongText )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Acceptor ¶
type Acceptor func(p *gen.MySqlParser, visitor *visitor) interface{}
Acceptor is the alias of function
type CaseChangingStream ¶
type CaseChangingStream struct { antlr.CharStream // contains filtered or unexported fields }
func (*CaseChangingStream) LA ¶
func (is *CaseChangingStream) LA(offset int) int
LA gets the value of the symbol at offset from the current position from the underlying CharStream and converts it to either upper case or lower case.
type Column ¶
type Column struct { Name string DataType DataType Constraint *ColumnConstraint }
type ColumnConstraint ¶
type ColumnDeclaration ¶
type ColumnDeclaration struct { Name string ColumnDefinition *ColumnDefinition }
type ColumnDefinition ¶
type ColumnDefinition struct { DataType DataType ColumnConstraint *ColumnConstraint }
type CreateTable ¶
type CreateTable struct { // Name describes the literal of table, this name can be specified as db_name.tbl_name, // https://dev.mysql.com/doc/refman/8.0/en/create-table.html#create-table-name Name string Columns []*ColumnDeclaration Constraints []*TableConstraint }
func (*CreateTable) Convert ¶
func (c *CreateTable) Convert() *Table
type DataType ¶
type DataType interface { Type() int Unsigned() bool // Value returns the values if the data type is Enum or Set Value() []string }
DataType describes the data type and value of the column in table
type EnumSetDataType ¶
type EnumSetDataType struct {
// contains filtered or unexported fields
}
EnumSetDataType describes the data type Enum and Set of column
func (*EnumSetDataType) Type ¶
func (e *EnumSetDataType) Type() int
Type returns the data type of column
func (*EnumSetDataType) Unsigned ¶ added in v1.0.4
func (e *EnumSetDataType) Unsigned() bool
Unsigned returns true if the data type is unsigned.
func (*EnumSetDataType) Value ¶
func (e *EnumSetDataType) Value() []string
Value returns the value of data type Enum and Set
type NormalDataType ¶
type NormalDataType struct {
// contains filtered or unexported fields
}
NormalDataType describes the data type which not contains Enum and Set of column
func (*NormalDataType) Type ¶
func (n *NormalDataType) Type() int
Type returns the data type of column
func (*NormalDataType) Unsigned ¶ added in v1.0.4
func (n *NormalDataType) Unsigned() bool
Unsigned returns true if the data type is unsigned.
type Option ¶
type Option func(p *Parser)
Option is the alias of function.
func WithConsole ¶
WithConsole is a Parser option to set console.
func WithDebugMode ¶
WithDebugMode is a Parser option to set debug mode.
type Parser ¶
type Parser struct { antlr.DefaultErrorListener // contains filtered or unexported fields }
Parser is the syntax entry to parse sql as AST, you can use NewParser to create an instance with options, WithDebugMode option can parse sql with debug, WithLogger option can print logs while parsing.
func (*Parser) SyntaxError ¶
func (p *Parser) SyntaxError(_ antlr.Recognizer, _ interface{}, line, column int, msg string, _ antlr.RecognitionException)
SyntaxError overrides SyntaxError from antlr.DefaultErrorListener, which could catch error from this function, and panic, the parser would catch the panic by testMysqlSyntax and returns.
type Table ¶
type Table struct { Name string Columns []*Column Constraints []*TableConstraint }