代码拉取完成,页面将自动刷新
package migrator
import (
"fmt"
"strings"
)
const (
POSTGRES = "postgres"
SQLITE = "sqlite3"
MYSQL = "mysql"
)
type Migration interface {
Sql(dialect Dialect) string
Id() string
SetId(string)
GetCondition() MigrationCondition
}
type SQLType string
type ColumnType string
const (
DB_TYPE_STRING ColumnType = "String"
)
type Table struct {
Name string
Columns []*Column
PrimaryKeys []string
Indices []*Index
}
const (
IndexType = iota + 1
UniqueIndex
)
type Index struct {
Name string
Type int
Cols []string
}
func (index *Index) XName(tableName string) string {
if index.Name == "" {
index.Name = fmt.Sprintf("%s", strings.Join(index.Cols, "_"))
}
if !strings.HasPrefix(index.Name, "UQE_") &&
!strings.HasPrefix(index.Name, "IDX_") {
if index.Type == UniqueIndex {
return fmt.Sprintf("UQE_%v_%v", tableName, index.Name)
}
return fmt.Sprintf("IDX_%v_%v", tableName, index.Name)
}
return index.Name
}
var (
DB_Bit = "BIT"
DB_TinyInt = "TINYINT"
DB_SmallInt = "SMALLINT"
DB_MediumInt = "MEDIUMINT"
DB_Int = "INT"
DB_Integer = "INTEGER"
DB_BigInt = "BIGINT"
DB_Enum = "ENUM"
DB_Set = "SET"
DB_Char = "CHAR"
DB_Varchar = "VARCHAR"
DB_NVarchar = "NVARCHAR"
DB_TinyText = "TINYTEXT"
DB_Text = "TEXT"
DB_MediumText = "MEDIUMTEXT"
DB_LongText = "LONGTEXT"
DB_Uuid = "UUID"
DB_Date = "DATE"
DB_DateTime = "DATETIME"
DB_Time = "TIME"
DB_TimeStamp = "TIMESTAMP"
DB_TimeStampz = "TIMESTAMPZ"
DB_Decimal = "DECIMAL"
DB_Numeric = "NUMERIC"
DB_Real = "REAL"
DB_Float = "FLOAT"
DB_Double = "DOUBLE"
DB_Binary = "BINARY"
DB_VarBinary = "VARBINARY"
DB_TinyBlob = "TINYBLOB"
DB_Blob = "BLOB"
DB_MediumBlob = "MEDIUMBLOB"
DB_LongBlob = "LONGBLOB"
DB_Bytea = "BYTEA"
DB_Bool = "BOOL"
DB_Serial = "SERIAL"
DB_BigSerial = "BIGSERIAL"
)
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。