gosmm

package
v2.0.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CloseDB

func CloseDB(db *sql.DB) error

CloseDB closes the database connection

func ConnectDB

func ConnectDB(config DBConfig) (*sql.DB, error)

ConnectDB connects to the database based on the given DBConfig

func DisplayStatus

func DisplayStatus(db *sql.DB) error

DisplayStatus displays the migration status

func Migrate

func Migrate(db *sql.DB, migrationsDir string, driver string) error

Migrate executes the SQL migrations in the given directory

func Restore

func Restore(db *sql.DB) error

Restore cleans up the migration history by deleting records with success = false

Types

type DBConfig

type DBConfig struct {
	Driver   string
	Host     string
	Port     int
	User     string
	Password string
	DBName   string
}

DBConfig holds the database configuration information

Jump to

Keyboard shortcuts

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