migrator

package
Version: v1.21.15 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2021 License: MIT Imports: 9 Imported by: 45

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BuildIndexOptionsInterface

type BuildIndexOptionsInterface interface {
	BuildIndexOptions([]schema.IndexOption, *gorm.Statement) []interface{}
}

type Config

type Config struct {
	CreateIndexAfterCreateTable bool
	DB                          *gorm.DB
	gorm.Dialector
}

Config schema config

type GormDataTypeInterface added in v0.2.3

type GormDataTypeInterface interface {
	GormDBDataType(*gorm.DB, *schema.Field) string
}

type Migrator

type Migrator struct {
	Config
}

Migrator m struct

func (Migrator) AddColumn

func (m Migrator) AddColumn(value interface{}, field string) error

func (Migrator) AlterColumn

func (m Migrator) AlterColumn(value interface{}, field string) error

func (Migrator) AutoMigrate

func (m Migrator) AutoMigrate(values ...interface{}) error

AutoMigrate

func (Migrator) BuildIndexOptions

func (m Migrator) BuildIndexOptions(opts []schema.IndexOption, stmt *gorm.Statement) (results []interface{})

func (Migrator) ColumnTypes

func (m Migrator) ColumnTypes(value interface{}) ([]gorm.ColumnType, error)

ColumnTypes return columnTypes []gorm.ColumnType and execErr error

func (Migrator) CreateConstraint

func (m Migrator) CreateConstraint(value interface{}, name string) error

func (Migrator) CreateIndex

func (m Migrator) CreateIndex(value interface{}, name string) error

func (Migrator) CreateTable

func (m Migrator) CreateTable(values ...interface{}) error

func (Migrator) CreateView

func (m Migrator) CreateView(name string, option gorm.ViewOption) error

func (Migrator) CurrentDatabase

func (m Migrator) CurrentDatabase() (name string)

func (Migrator) CurrentTable added in v1.20.6

func (m Migrator) CurrentTable(stmt *gorm.Statement) interface{}

func (Migrator) DataTypeOf

func (m Migrator) DataTypeOf(field *schema.Field) string

func (Migrator) DropColumn

func (m Migrator) DropColumn(value interface{}, name string) error

func (Migrator) DropConstraint

func (m Migrator) DropConstraint(value interface{}, name string) error

func (Migrator) DropIndex

func (m Migrator) DropIndex(value interface{}, name string) error

func (Migrator) DropTable

func (m Migrator) DropTable(values ...interface{}) error

func (Migrator) DropView

func (m Migrator) DropView(name string) error

func (Migrator) FullDataTypeOf

func (m Migrator) FullDataTypeOf(field *schema.Field) (expr clause.Expr)

func (Migrator) GuessConstraintAndTable added in v1.20.12

func (m Migrator) GuessConstraintAndTable(stmt *gorm.Statement, name string) (_ *schema.Constraint, _ *schema.Check, table string)

func (Migrator) HasColumn

func (m Migrator) HasColumn(value interface{}, field string) bool

func (Migrator) HasConstraint

func (m Migrator) HasConstraint(value interface{}, name string) bool

func (Migrator) HasIndex

func (m Migrator) HasIndex(value interface{}, name string) bool

func (Migrator) HasTable

func (m Migrator) HasTable(value interface{}) bool

func (Migrator) MigrateColumn added in v0.2.36

func (m Migrator) MigrateColumn(value interface{}, field *schema.Field, columnType gorm.ColumnType) error

func (Migrator) RenameColumn

func (m Migrator) RenameColumn(value interface{}, oldName, newName string) error

func (Migrator) RenameIndex

func (m Migrator) RenameIndex(value interface{}, oldName, newName string) error

func (Migrator) RenameTable

func (m Migrator) RenameTable(oldName, newName interface{}) error

func (Migrator) ReorderModels

func (m Migrator) ReorderModels(values []interface{}, autoAdd bool) (results []interface{})

ReorderModels reorder models according to constraint dependencies

func (Migrator) RunWithValue

func (m Migrator) RunWithValue(value interface{}, fc func(*gorm.Statement) error) error

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL