Documentation ¶
Index ¶
- Constants
- Variables
- func HasCharset(ft *FieldType) bool
- func IsTypeBlob(tp byte) bool
- func IsTypeChar(tp byte) bool
- func TypeStr(tp byte) (r string)
- func TypeToStr(tp byte, cs string) (r string)
- type EvalType
- type FieldType
- func (ft *FieldType) Clone() *FieldType
- func (ft *FieldType) CompactStr() string
- func (ft *FieldType) Equal(other *FieldType) bool
- func (ft *FieldType) EvalType() EvalType
- func (ft *FieldType) FormatAsCastType(w io.Writer)
- func (ft *FieldType) Hybrid() bool
- func (ft *FieldType) InfoSchemaStr() string
- func (ft *FieldType) Init(tp byte)
- func (ft *FieldType) Restore(ctx *format.RestoreCtx) error
- func (ft *FieldType) RestoreAsCastType(ctx *format.RestoreCtx)
- func (ft *FieldType) StorageLength() int
- func (ft *FieldType) String() string
Constants ¶
const (
UnspecifiedLength = -1
)
UnspecifiedLength is unspecified length.
const VarStorageLen = -1
VarStorageLen indicates this column is a variable length column.
Variables ¶
var ErrInvalidDefault = terror.ClassTypes.New(mysql.ErrInvalidDefault, mysql.MySQLErrName[mysql.ErrInvalidDefault])
ErrInvalidDefault is returned when meet a invalid default value.
Functions ¶
func HasCharset ¶
HasCharset indicates if a COLUMN has an associated charset. Returning false here prevents some information statements(like `SHOW CREATE TABLE`) from attaching a CHARACTER SET clause to the column.
func IsTypeBlob ¶
IsTypeBlob returns a boolean indicating whether the tp is a blob type.
func IsTypeChar ¶
IsTypeChar returns a boolean indicating whether the tp is the char type like a string type or a varchar type.
Types ¶
type EvalType ¶
type EvalType byte
EvalType indicates the specified types that arguments and result of a built-in function should be.
const ( // ETInt represents type INT in evaluation. ETInt EvalType = iota // ETReal represents type REAL in evaluation. ETReal // ETDecimal represents type DECIMAL in evaluation. ETDecimal // ETString represents type STRING in evaluation. ETString // ETDatetime represents type DATETIME in evaluation. ETDatetime // ETTimestamp represents type TIMESTAMP in evaluation. ETTimestamp // ETDuration represents type DURATION in evaluation. ETDuration // ETJson represents type JSON in evaluation. ETJson )
func (EvalType) IsStringKind ¶
IsStringKind returns true for ETString, ETDatetime, ETTimestamp, ETDuration, ETJson EvalTypes.
type FieldType ¶
type FieldType struct { Tp byte Flag uint Flen int Decimal int Charset string Collate string // Elems is the element list for enum and set type. Elems []string }
FieldType records field type information.
func NewFieldType ¶
NewFieldType returns a FieldType, with a type and other information about field type.
func (*FieldType) CompactStr ¶
CompactStr only considers Tp/CharsetBin/Flen/Deimal. This is used for showing column type in infoschema.
func (*FieldType) FormatAsCastType ¶
FormatAsCastType is used for write AST back to string.
func (*FieldType) Hybrid ¶
Hybrid checks whether a type is a hybrid type, which can represent different types of value in specific context.
func (*FieldType) InfoSchemaStr ¶
InfoSchemaStr joins the CompactStr with unsigned flag and returns a string.
func (*FieldType) Restore ¶
func (ft *FieldType) Restore(ctx *format.RestoreCtx) error
Restore implements Node interface.
func (*FieldType) RestoreAsCastType ¶
func (ft *FieldType) RestoreAsCastType(ctx *format.RestoreCtx)
RestoreAsCastType is used for write AST back to string.
func (*FieldType) StorageLength ¶
StorageLength is the length of stored value for the type.