schema

package
v2.2.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 20, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Normalize

func Normalize(v string) string

Types

type Column

type Column struct {
	Name            string
	NomarlizedName  string
	Type            ColumnType
	Len             int
	GoType          string
	NullableType    string
	IsPrimary       bool
	IsNotNull       bool
	IsUnique        bool
	IsBinary        bool
	IsAutoIncrement bool
	IsID            bool
	IsPlural        bool
	Comment         string
	Enums           map[string]string
}

type ColumnType

type ColumnType string
const (
	TypeUnknown     ColumnType = ""
	TypeUnspecified ColumnType = "Unspecified"
	TypeTinyInt     ColumnType = "Tiny"
	TypeSmallInt    ColumnType = "Small"
	TypeBigInt      ColumnType = "Big"
	TypeFloat       ColumnType = "Float"
	TypeDouble      ColumnType = "Double"
	TypeNull        ColumnType = "Null"
	TypeTimestamp   ColumnType = "Timestamp"
	TypeLonglong    ColumnType = "Longlong"
	TypeInt24       ColumnType = "Int24"
	TypeDate        ColumnType = "Date"
	TypeDuration    ColumnType = "Duration"
	TypeDatetime    ColumnType = "Datetime"
	TypeYear        ColumnType = "Year"
	TypeNewDate     ColumnType = "NewDate"
	TypeVarchar     ColumnType = "Varchar"
	TypeBit         ColumnType = "Bit"
	TypeJSON        ColumnType = "JSON"
	TypeNewDecimal  ColumnType = "NewDecimal"
	TypeEnum        ColumnType = "Enum"
	TypeSet         ColumnType = "Set"
	TypeTinyBlob    ColumnType = "TinyBlob"
	TypeMediumBlob  ColumnType = "MediumBlob"
	TypeLongBlob    ColumnType = "LongBlob"
	TypeBlob        ColumnType = "Blob"
	TypeVarString   ColumnType = "VarString"
	TypeString      ColumnType = "String"
	TypeGeometry    ColumnType = "Geometry"
)

func (ColumnType) String

func (t ColumnType) String() string

type Parser

type Parser interface {
	ParseCreateTable(ddl string) ([]*Table, error)
}

func GetParser

func GetParser() Parser

type Table

type Table struct {
	Name           string
	NomarlizedName string
	SingularName   string
	IsPlural       bool
	Columns        []*Column
	PrimaryKeys    []string
}

type TidbParser

type TidbParser struct {
	// contains filtered or unexported fields
}

func NewTidbParser

func NewTidbParser() *TidbParser

func (TidbParser) ParseCreateTable

func (s TidbParser) ParseCreateTable(ddl string) ([]*Table, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL