db/schema/grammar.go
2023-04-12 15:58:25 +08:00

45 lines
1.7 KiB
Go

package schema
import (
"git.fsdpf.net/go/db"
)
type IGrammar interface {
// 判断表是否存在
CompileTableExists() string
// 字段列
CompileColumnListing(table string) string
// 创建表
CompileCreate(bp *Blueprint, command *Command, conn *db.Connection) string
// 添加字段
CompileAdd(bp *Blueprint, command *Command, conn *db.Connection) []string
// 修改字段
CompileChange(bp *Blueprint, command *Command, conn *db.Connection) []string
// 添加主键
// CompilePrimary(bp *Blueprint, command *Command, conn *db.Connection) string
// 添加唯一键
CompileUnique(bp *Blueprint, command *Command, conn *db.Connection) string
// 添加普通索引
CompileIndex(bp *Blueprint, command *Command, conn *db.Connection) string
// 添加空间索引
CompileSpatialIndex(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除表
CompileDrop(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除表, 先判断再删除
CompileDropIfExists(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除表, 删除列
CompileDropColumn(bp *Blueprint, command *Command, conn *db.Connection) []string
// 删除主键
// CompileDropPrimary(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除唯一键
CompileDropUnique(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除唯普通索引
CompileDropIndex(bp *Blueprint, command *Command, conn *db.Connection) string
// 删除唯空间索引
CompileDropSpatialIndex(bp *Blueprint, command *Command, conn *db.Connection) string
// 表重命名
CompileRename(bp *Blueprint, command *Command, conn *db.Connection) string
// 索引重命名
CompileRenameIndex(bp *Blueprint, command *Command, conn *db.Connection) string
}