database

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2026 License: AGPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Migrations embed.FS

Functions

func CloseAll

func CloseAll() error

CloseAll closes all connections

func CloseConnection

func CloseConnection(name string) error

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

func GetConnection(name string, cfg *config.PostgresConfig) (*gorm.DB, error)

GetConnection returns a database connection by name

func GetDB

func GetDB(name string) (*gorm.DB, bool)

GetDB returns a specific 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 Ready

func Ready(name string) bool

Ready checks if a specific connection is alive

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.

Jump to

Keyboard shortcuts

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