Documentation
¶
Index ¶
- func CheckMigrate(db *gorm.DB, objects []interface{}) []string
- type CustomLogger
- func (c *CustomLogger) Error(_ context.Context, msg string, data ...interface{})
- func (c *CustomLogger) Info(_ context.Context, msg string, data ...interface{})
- func (c *CustomLogger) LogMode(level logger.LogLevel) logger.Interface
- func (c *CustomLogger) Trace(_ context.Context, begin time.Time, fc func() (string, int64), err error)
- func (c *CustomLogger) Warn(_ context.Context, msg string, data ...interface{})
- type MigrationKind
- type MigrationOp
- type MigrationOps
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckMigrate ¶
CheckMigrate 这个函数用来对比DB和模型,检查DB里缺少什么没有执行的语句
Types ¶
type CustomLogger ¶
type CustomLogger struct {
SQLs []string
}
CustomLogger 自定义 Logger 捕获执行过的 SQL 语句
func (*CustomLogger) Error ¶
func (c *CustomLogger) Error(_ context.Context, msg string, data ...interface{})
func (*CustomLogger) Info ¶
func (c *CustomLogger) Info(_ context.Context, msg string, data ...interface{})
func (*CustomLogger) LogMode ¶
func (c *CustomLogger) LogMode(level logger.LogLevel) logger.Interface
type MigrationKind ¶ added in v0.0.11
type MigrationOp ¶ added in v0.0.11
type MigrationOp struct { ForwardSQL string Kind *MigrationKind }
func NewMigrationOp ¶ added in v0.0.11
func NewMigrationOp(forwardSQL string) (*MigrationOp, bool)
func (*MigrationOp) GetForwardSQL ¶ added in v0.0.11
func (op *MigrationOp) GetForwardSQL() string
func (*MigrationOp) GetReverseSQL ¶ added in v0.0.11
func (op *MigrationOp) GetReverseSQL() (string, bool)
type MigrationOps ¶ added in v0.0.11
type MigrationOps []*MigrationOp
func GetMigrateOps ¶ added in v0.0.11
func GetMigrateOps(db *gorm.DB, objects []interface{}) MigrationOps
func (MigrationOps) GetForwardSQLs ¶ added in v0.0.11
func (ops MigrationOps) GetForwardSQLs() []string
func (MigrationOps) GetForwardScript ¶ added in v0.0.11
func (ops MigrationOps) GetForwardScript() string
func (MigrationOps) GetReverseScript ¶ added in v0.0.11
func (ops MigrationOps) GetReverseScript() (string, bool)
func (MigrationOps) SearchOp ¶ added in v0.0.11
func (ops MigrationOps) SearchOp(forwardSQL string) *MigrationOp
Click to show internal directories.
Click to hide internal directories.