newmigrate

package
v0.0.8 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMigrate

func NewMigrate[T database.Driver](param *Param) (*migrate.Migrate, error)

NewMigrate creates a new migration instance. T must implement database.Driver interface, e.g.:

  • sqlite3.Sqlite from "github.com/golang-migrate/migrate/v4/database/sqlite3"
  • mysql.Mysql from "github.com/golang-migrate/migrate/v4/database/mysql"
  • postgres.Postgres from "github.com/golang-migrate/migrate/v4/database/postgres"

Note: The type param T is used to trigger side effects.

Example:

  • migration, err := NewMigrate[*sqlite3.Sqlite](param)
  • migration, err := NewMigrate[*mysql.Mysql](param)
  • migration, err := NewMigrate[*postgres.Postgres](param)

Types

type Param

type Param struct {
	ScriptsInRoot string
	ConnectSource string
}

Jump to

Keyboard shortcuts

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