database

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AutoMigrate added in v0.5.0

func AutoMigrate(db *gorm.DB, models ...any) error

AutoMigrate runs GORM auto-migration for the given models one at a time, in the order given. Callers must list referenced models before the models that reference them, so tables exist before GORM creates foreign keys to them.

func ConnectGormDB

func ConnectGormDB(config *DatabaseConfig) (*gorm.DB, error)

ConnectGormDB establishes a GORM connection to PostgreSQL

Types

type DatabaseConfig

type DatabaseConfig struct {
	Host            string
	Port            string
	Username        string
	Password        string
	Database        string
	SSLMode         string
	MaxOpenConns    int
	MaxIdleConns    int
	ConnMaxLifetime time.Duration
	ConnMaxIdleTime time.Duration
}

DatabaseConfig holds GORM database connection configuration

func NewDatabaseConfig

func NewDatabaseConfig() *DatabaseConfig

NewDatabaseConfig creates a new GORM database configuration for V1

Directories

Path Synopsis
Package dbtest provides database fixtures for Portal Backend tests.
Package dbtest provides database fixtures for Portal Backend tests.

Jump to

Keyboard shortcuts

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