migrationhelper

package
v0.15.1-beta3 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2023 License: Apache-2.0, MIT Imports: 9 Imported by: 20

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrateTables

func AutoMigrateTables(basicRes core.BasicRes, dst ...interface{}) errors.Error

AutoMigrateTables runs AutoMigrate for muliple tables

func ChangeColumnsType

func ChangeColumnsType[D any](
	basicRes core.BasicRes,
	script core.MigrationScript,
	tableName string,
	columns []string,
	update func(tmpColumnParams []interface{}) errors.Error,
) (err errors.Error)

ChangeColumnsType change the type of specified columns for the table

func CopyTableColumns

func CopyTableColumns[S any, D any](
	basicRes core.BasicRes,
	srcTableName string,
	dstTableName string,
	transform func(*S) (*D, errors.Error),
) (err errors.Error)

CopyTableColumns can copy data from src table to dst table

func PrimarykeyIsAutoIncrement

func PrimarykeyIsAutoIncrement(db dal.Dal, tableName string) errors.Error

PrimarykeyIsAutoIncrement check if the Primarykey is auto increment

func TransformColumns

func TransformColumns[S any, D any](
	basicRes core.BasicRes,
	script core.MigrationScript,
	tableName string,
	columns []string,
	transform func(src *S) (*D, errors.Error),
) (err errors.Error)

TransformColumns change the type of specified columns for the table and transform data one by one

func TransformTable

func TransformTable[S any, D any](
	basicRes core.BasicRes,
	script core.MigrationScript,
	tableName string,
	transform func(*S) (*D, errors.Error),
) (err errors.Error)

TransformTable can be used when we need to change the table structure and reprocess all the data in the table.

Types

This section is empty.

Jump to

Keyboard shortcuts

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