checkmigration

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckMigrate

func CheckMigrate(db *gorm.DB, objects []interface{}) []string

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

func (*CustomLogger) Trace

func (c *CustomLogger) Trace(_ context.Context, begin time.Time, fc func() (string, int64), err error)

func (*CustomLogger) Warn

func (c *CustomLogger) Warn(_ context.Context, msg string, data ...interface{})

type MigrationKind added in v0.0.11

type MigrationKind struct {
	ForwardSubstr string
	ReverseSubstr string
}

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

Jump to

Keyboard shortcuts

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