Documentation ¶
Index ¶
- Variables
- func ExprToExpression(ctx *sql.Context, e sqlparser.Expr) (sql.Expression, error)
- func ExpressionToColumnDefaultValue(ctx *sql.Context, inputExpr sql.Expression, isLiteral bool) (*sql.ColumnDefaultValue, error)
- func MustStringToColumnDefaultValue(ctx *sql.Context, exprStr string, outType sql.Type, nullable bool) *sql.ColumnDefaultValue
- func Parse(ctx *sql.Context, query string) (sql.Node, error)
- func ParseColumnTypeString(ctx *sql.Context, columnType string) (sql.Type, error)
- func StringToColumnDefaultValue(ctx *sql.Context, exprStr string) (*sql.ColumnDefaultValue, error)
- func TableSpecToSchema(ctx *sql.Context, tableSpec *sqlparser.TableSpec) (sql.Schema, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrUnsupportedSyntax is thrown when a specific syntax is not already supported ErrUnsupportedSyntax = errors.NewKind("unsupported syntax: %s") // ErrUnsupportedFeature is thrown when a feature is not already supported ErrUnsupportedFeature = errors.NewKind("unsupported feature: %s") // ErrInvalidSQLValType is returned when a SQLVal type is not valid. ErrInvalidSQLValType = errors.NewKind("invalid SQLVal of type: %d") // ErrInvalidSortOrder is returned when a sort order is not valid. ErrInvalidSortOrder = errors.NewKind("invalid sort order: %s") ErrInvalidIndexPrefix = errors.NewKind("invalid index prefix: %v") ErrUnknownIndexColumn = errors.NewKind("unknown column: '%s' in %s index '%s'") ErrInvalidAutoIncCols = errors.NewKind("there can be only one auto_increment column and it must be defined as a key") ErrUnknownConstraintDefinition = errors.NewKind("unknown constraint definition: %s, %T") ErrInvalidCheckConstraint = errors.NewKind("invalid constraint definition: %s") )
Functions ¶
func ExprToExpression ¶
func ExpressionToColumnDefaultValue ¶
func ExpressionToColumnDefaultValue(ctx *sql.Context, inputExpr sql.Expression, isLiteral bool) (*sql.ColumnDefaultValue, error)
ExpressionToColumnDefaultValue takes in an Expression and returns the equivalent ColumnDefaultValue if the expression is valid for a default value. If the expression represents a literal (and not an expression that returns a literal, so "5" rather than "(5)"), then the parameter "isLiteral" should be true.
func MustStringToColumnDefaultValue ¶
func MustStringToColumnDefaultValue(ctx *sql.Context, exprStr string, outType sql.Type, nullable bool) *sql.ColumnDefaultValue
MustStringToColumnDefaultValue is used for creating default values on tables that do not go through the analyzer. Does not handle function nor column references.
func ParseColumnTypeString ¶
ParseColumnTypeString will return a SQL type for the given string that represents a column type. For example, giving the string `VARCHAR(255)` will return the string SQL type with the internal type set to Varchar and the length set to 255 with the default collation.
func StringToColumnDefaultValue ¶
StringToColumnDefaultValue takes in a string representing a default value and returns the equivalent Expression.
Types ¶
This section is empty.