dbrepo

package
v0.0.0-...-97aed24 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DBDRIVER_POSTGRES = "POSTGRES"
	DBDRIVER_MYSQL    = "MYSQL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DBConnectionData

type DBConnectionData struct {
	DBHost     string
	DBPort     string
	DBName     string
	DBUser     string
	DBPassword string
	DBSSL      string
}

type DBDriver

type DBDriver interface {
	Open(dbConnData DBConnectionData) (*sql.DB, error)
	SetupMigrationTableSQL() string
	MigrateDBSQL(migrationDirection string) (string, error)
	CurrentVersionSQL() string
	MigratedVersionsSQL() string
}

type DBRepo

type DBRepo struct {
	// contains filtered or unexported fields
}

func NewDBRepo

func NewDBRepo(dbdrivername string, connData DBConnectionData, a *config.AppConfig) (*DBRepo, error)

func (*DBRepo) CloseDB

func (r *DBRepo) CloseDB() error

func (*DBRepo) ConnectToDB

func (r *DBRepo) ConnectToDB() error

func (DBRepo) CurrentVersion

func (r DBRepo) CurrentVersion() (string, error)

func (DBRepo) MigrateDB

func (r DBRepo) MigrateDB(toVersion, migrationDirection string) error

func (DBRepo) MigrateData

func (r DBRepo) MigrateData(toVersion, script, migrationDirection string) error

func (DBRepo) MigratedVersions

func (r DBRepo) MigratedVersions() ([]string, error)

func (DBRepo) SetupMigrationTable

func (r DBRepo) SetupMigrationTable() error

type MySQLDBDriver

type MySQLDBDriver struct {
}

func (*MySQLDBDriver) CurrentVersionSQL

func (d *MySQLDBDriver) CurrentVersionSQL() string

func (*MySQLDBDriver) MigrateDBSQL

func (d *MySQLDBDriver) MigrateDBSQL(migrationDirection string) (string, error)

func (*MySQLDBDriver) MigratedVersionsSQL

func (d *MySQLDBDriver) MigratedVersionsSQL() string

func (*MySQLDBDriver) Open

func (d *MySQLDBDriver) Open(dbConnData DBConnectionData) (*sql.DB, error)

func (*MySQLDBDriver) SetupMigrationTableSQL

func (d *MySQLDBDriver) SetupMigrationTableSQL() string

type PostgresDBDriver

type PostgresDBDriver struct {
}

func (*PostgresDBDriver) CurrentVersionSQL

func (d *PostgresDBDriver) CurrentVersionSQL() string

func (*PostgresDBDriver) MigrateDBSQL

func (d *PostgresDBDriver) MigrateDBSQL(migrationDirection string) (string, error)

func (*PostgresDBDriver) MigratedVersionsSQL

func (d *PostgresDBDriver) MigratedVersionsSQL() string

func (*PostgresDBDriver) Open

func (d *PostgresDBDriver) Open(dbConnData DBConnectionData) (*sql.DB, error)

func (*PostgresDBDriver) SetupMigrationTableSQL

func (d *PostgresDBDriver) SetupMigrationTableSQL() string

Jump to

Keyboard shortcuts

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