database

package
v0.0.0-...-6da63fb Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: AGPL-3.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultPostgresMaxOpenConns    = 25
	DefaultPostgresMaxIdleConns    = 5
	DefaultPostgresConnMaxLifetime = 30 * time.Minute
	DefaultPostgresConnMaxIdleTime = 5 * time.Minute
)

Variables

This section is empty.

Functions

func Connect

func Connect(databaseURL string) (*bun.DB, error)

Connect creates a database connection based on the provided DATABASE_URL

func ConnectWithOptions

func ConnectWithOptions(databaseURL string, options ConnectionOptions) (*bun.DB, error)

ConnectWithOptions creates a database connection based on the provided DATABASE_URL and optional pool tuning overrides.

func GetDatabaseType

func GetDatabaseType(databaseURL string) (string, error)

GetDatabaseType returns the database type from a DATABASE_URL

Types

type Config

type Config struct {
	Type     string
	Host     string
	Port     string
	Database string
	Username string
	Password string
	SSLMode  string
	Path     string // For SQLite
}

Config holds database connection configuration

func ParseDatabaseURL

func ParseDatabaseURL(databaseURL string) (*Config, error)

ParseDatabaseURL parses a DATABASE_URL and returns a DatabaseConfig

type ConnectionOptions

type ConnectionOptions struct {
	PostgresMaxOpenConns    int
	PostgresMaxIdleConns    int
	PostgresConnMaxLifetime time.Duration
	PostgresConnMaxIdleTime time.Duration
}

Jump to

Keyboard shortcuts

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