newmigrate

package
v0.0.9 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWithEmbedAndDatabase added in v0.0.9

func NewWithEmbedAndDatabase(param *EmbedAndDatabaseParam) (*migrate.Migrate, error)

func NewWithScriptsAndSource added in v0.0.9

func NewWithScriptsAndSource[T database.Driver](param *ScriptsAndSourceParam) (*migrate.Migrate, error)

NewWithScriptsAndSource 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 := NewWithScriptsAndSource[*sqlite3.Sqlite](param)
  • migration, err := NewWithScriptsAndSource[*mysql.Mysql](param)
  • migration, err := NewWithScriptsAndSource[*postgres.Postgres](param)

Types

type EmbedAndDatabaseParam added in v0.0.9

type EmbedAndDatabaseParam struct {
	MigrationsFS     *embed.FS
	EmbedDirName     string
	DatabaseName     string
	DatabaseInstance database.Driver
}

type ScriptsAndSourceParam added in v0.0.9

type ScriptsAndSourceParam struct {
	ScriptsInRoot string
	ConnectSource string
}

Jump to

Keyboard shortcuts

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