Documentation
¶
Index ¶
- Variables
- func CloseAll() error
- func CloseConnection(name string) error
- func ForceMigrationVersion(cfg *config.PostgresConfig, version int) error
- func GetConnection(name string, cfg *config.PostgresConfig) (*gorm.DB, error)
- func GetDB(name string) (*gorm.DB, bool)
- func ListConnections() []string
- func MigrationVersion(cfg *config.PostgresConfig) (uint, bool, error)
- func Ready(name string) bool
- func RollbackMigration(cfg *config.PostgresConfig) error
- func RunMigrations(cfg *config.PostgresConfig) error
Constants ¶
This section is empty.
Variables ¶
View Source
var Migrations embed.FS
Functions ¶
func CloseConnection ¶
CloseConnection safely closes and removes a connection
func ForceMigrationVersion ¶
func ForceMigrationVersion(cfg *config.PostgresConfig, version int) error
ForceMigrationVersion sets the migration version without running migrations Use with caution - this is for fixing dirty state issues
func GetConnection ¶
GetConnection returns a database connection by name
func ListConnections ¶
func ListConnections() []string
ListConnections returns a list of all connection names
func MigrationVersion ¶
func MigrationVersion(cfg *config.PostgresConfig) (uint, bool, error)
MigrationVersion returns the current migration version
func RollbackMigration ¶
func RollbackMigration(cfg *config.PostgresConfig) error
RollbackMigration rolls back the last migration
func RunMigrations ¶
func RunMigrations(cfg *config.PostgresConfig) error
RunMigrations executes all pending database migrations
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.