database

package
v0.0.0-...-bc34401 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Up   = "up"
	Down = "down"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DbInstantiator

type DbInstantiator interface {
	GetConnection() (db *sqlx.DB)
	CreateDatabase(databaseName string)
	DropDatabase(databaseName string)
	GetDatabaseName() string
	GetDatabaseDriver() (database.Driver, error)
	Connect() (db *sqlx.DB)
}

type DbMigration

type DbMigration struct {
	RootPath     string
	DbInstance   DbInstantiator
	MigrationDir string
}

func NewDbMigration

func NewDbMigration(dbInstance DbInstantiator, conf config.Config) DbMigration

NewDbMigration is a function that returns a new DbMigration

func (*DbMigration) Migrate

func (d *DbMigration) Migrate(action string) error

Migrate is a function that migrates down

type DbSQLInstance

type DbSQLInstance struct {
	Connection   *sqlx.DB
	Dsn          string
	DatabaseName string
	DriverName   string
}

func NewDbSQLInstance

func NewDbSQLInstance(conf config.Config) *DbSQLInstance

NewDbSQLInstance is a function that returns a new DbSQLInstance

func (*DbSQLInstance) Connect

func (d *DbSQLInstance) Connect() (db *sqlx.DB)

Connect Connect

func (*DbSQLInstance) CreateDatabase

func (d *DbSQLInstance) CreateDatabase(databaseName string)

CreateDatabase is a function that creates a database

func (*DbSQLInstance) DropDatabase

func (d *DbSQLInstance) DropDatabase(databaseName string)

DropDatabase DropDatabase

func (*DbSQLInstance) GetConnection

func (d *DbSQLInstance) GetConnection() (db *sqlx.DB)

GetConnection GetConnection

func (*DbSQLInstance) GetDatabaseDriver

func (d *DbSQLInstance) GetDatabaseDriver() (database.Driver, error)

GetDatabaseDriver is a function that returns the database driver

func (*DbSQLInstance) GetDatabaseName

func (d *DbSQLInstance) GetDatabaseName() string

GetDatabaseName GetDatabaseName

Jump to

Keyboard shortcuts

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