migrationhelper

package
v0.0.0-...-7d3b672 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrateTables

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

AutoMigrateTables runs AutoMigrate for muliple tables

func ChangeColumnsType

func ChangeColumnsType[D any](
	basicRes context.BasicRes,
	script plugin.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 context.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 context.BasicRes,
	script plugin.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 context.BasicRes,
	script plugin.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