newmigrate

package
v0.0.10 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 NewWithEmbedFsAndDatabase added in v0.0.10

func NewWithEmbedFsAndDatabase(param *EmbedFsAndDatabaseParam) (*migrate.Migrate, error)

func NewWithScriptsAndDBSource added in v0.0.10

func NewWithScriptsAndDBSource[T database.Driver](param *ScriptsAndDBSourceParam) (*migrate.Migrate, error)

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

func NewWithScriptsAndDatabase added in v0.0.10

func NewWithScriptsAndDatabase(param *ScriptsAndDatabaseParam) (*migrate.Migrate, error)

Types

type EmbedFsAndDatabaseParam added in v0.0.10

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

type ScriptsAndDBSourceParam added in v0.0.10

type ScriptsAndDBSourceParam struct {
	ScriptsInRoot string
	ConnectSource string
}

type ScriptsAndDatabaseParam added in v0.0.10

type ScriptsAndDatabaseParam struct {
	ScriptsInRoot    string
	DatabaseName     string
	DatabaseInstance database.Driver
}

Jump to

Keyboard shortcuts

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