config

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package config provides configuration types for containerized databases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLConfig

type MySQLConfig struct {
	// Image is the Docker image to use. Defaults to mysql:8.0
	Image string
	// Username for MySQL. Defaults to root
	Username string
	// Password for MySQL. Defaults to rootpassword
	Password string
	// Database name. Defaults to testdb
	Database string
	// HealthCheckTimeout for container readiness. Defaults to 30s
	HealthCheckTimeout time.Duration
	// HealthCheckRetries for connection attempts. Defaults to 3
	HealthCheckRetries int
	// HealthCheckInterval between retries. Defaults to 500ms
	HealthCheckInterval time.Duration
	// MaxOpenConns is the max number of open connections. Defaults to 10
	MaxOpenConns int
	// MaxIdleConns is the max number of idle connections. Defaults to 5
	MaxIdleConns int
	// ConnMaxLifetime is the max lifetime of a connection. Defaults to 1 hour
	ConnMaxLifetime time.Duration
}

MySQLConfig holds configuration for MySQL containers.

func DefaultMySQLConfig

func DefaultMySQLConfig() *MySQLConfig

DefaultMySQLConfig returns a config with sensible defaults.

type PostgresConfig

type PostgresConfig struct {
	// Image is the Docker image to use. Defaults to postgres:16-alpine
	Image string
	// Username. Defaults to postgres
	Username string
	// Password. Defaults to postgres
	Password string
	// Database name. Defaults to testdb
	Database string
	// HealthCheckTimeout. Defaults to 30s
	HealthCheckTimeout time.Duration
	// HealthCheckRetries for connection attempts. Defaults to 3
	HealthCheckRetries int
	// HealthCheckInterval between retries. Defaults to 500ms
	HealthCheckInterval time.Duration
	// MaxOpenConns is the max number of open connections. Defaults to 10
	MaxOpenConns int
	// MaxIdleConns is the max number of idle connections. Defaults to 5
	MaxIdleConns int
	// ConnMaxLifetime is the max lifetime of a connection. Defaults to 1 hour
	ConnMaxLifetime time.Duration
}

PostgresConfig holds configuration for PostgreSQL containers.

func DefaultPostgresConfig

func DefaultPostgresConfig() *PostgresConfig

DefaultPostgresConfig returns a config with sensible defaults.

type SQLiteConfig

type SQLiteConfig struct {
	// Mode determines the database mode: "memory", "temp", or "file"
	Mode string
	// Path is the file path (used when Mode is "file")
	Path string
	// Cache controls the cache mode: "shared", "private", "write"
	Cache string
}

SQLiteConfig holds configuration for SQLite databases.

func DefaultSQLiteConfig

func DefaultSQLiteConfig() *SQLiteConfig

DefaultSQLiteConfig returns a config with sensible defaults (in-memory).

Jump to

Keyboard shortcuts

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