database

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PostgresSQLConnection

func PostgresSQLConnection() (*gorm.DB, error)

func PostgresSQLConnectionWithConfig added in v1.0.0

func PostgresSQLConnectionWithConfig(cfg PostgresConfig, deps PostgresDeps) (*gorm.DB, error)

PostgresSQLConnectionWithConfig starts a Postgres connection using explicit config and deps.

Types

type PostgresConfig added in v1.0.0

type PostgresConfig struct {
	MaxConnections     int
	MaxIdleConnections int
	MaxLifetime        time.Duration
}

PostgresConfig defines pooled connection settings.

func PostgresConfigFromEnv added in v1.0.0

func PostgresConfigFromEnv() (PostgresConfig, error)

PostgresConfigFromEnv reads database pool config from environment variables.

type PostgresDeps added in v1.0.0

type PostgresDeps struct {
	BuildConnectionURL func(name string) (string, error)
	Open               func(dsn string) (*gorm.DB, error)
}

PostgresDeps defines external dependencies to keep connection setup testable.

func DefaultPostgresDeps added in v1.0.0

func DefaultPostgresDeps() PostgresDeps

DefaultPostgresDeps returns production defaults for Postgres dependencies.

Jump to

Keyboard shortcuts

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