pgsql

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2026 License: MIT Imports: 12 Imported by: 0

README

bunorm/pgsql

PostgreSQL provider module for Bun ORM integration with Melody.

This module implements bunorm.Provider and produces a *bun.DB configured with the PostgreSQL dialect.

Import

  • github.com/precision-soft/melody/integrations/bunorm
  • github.com/precision-soft/melody/integrations/bunorm/pgsql

Provider

pgsql.Provider reads configuration values from Melody config using the parameter names passed to NewProvider(...).

Common parameter names:

  • DB_HOST
  • DB_PORT
  • DB_DATABASE
  • DB_USER
  • DB_PASSWORD

Pool and timeout defaults can be overridden via WithPoolConfig(...) and WithTimeoutConfig(...).

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnectionConfig

type ConnectionConfig struct {
	// contains filtered or unexported fields
}

func NewConnectionConfig

func NewConnectionConfig(host string, port string, database string, user string, password string) *ConnectionConfig

func (*ConnectionConfig) Database

func (instance *ConnectionConfig) Database() string

func (*ConnectionConfig) Host

func (instance *ConnectionConfig) Host() string

func (*ConnectionConfig) Password

func (instance *ConnectionConfig) Password() string

func (*ConnectionConfig) Port

func (instance *ConnectionConfig) Port() string

func (*ConnectionConfig) SafeContext

func (instance *ConnectionConfig) SafeContext() map[string]any

func (*ConnectionConfig) User

func (instance *ConnectionConfig) User() string

type PoolConfig

type PoolConfig struct {
	MaxOpenConnections    int
	MaxIdleConnections    int
	ConnectionMaxLifetime time.Duration
	ConnectionMaxIdleTime time.Duration
}

func DefaultPoolConfig

func DefaultPoolConfig() *PoolConfig

type Provider

type Provider struct {
	// contains filtered or unexported fields
}

func NewProvider

func NewProvider(
	hostParameterName string,
	portParameterName string,
	databaseParameterName string,
	userParameterName string,
	passwordParameterName string,
) *Provider

func NewProviderWithConfig

func NewProviderWithConfig(
	hostParameterName string,
	portParameterName string,
	databaseParameterName string,
	userParameterName string,
	passwordParameterName string,
	poolConfig *PoolConfig,
	timeoutConfig *TimeoutConfig,
) *Provider

func (*Provider) Open

func (instance *Provider) Open(resolver containercontract.Resolver) (*bun.DB, error)

func (*Provider) WithPoolConfig

func (instance *Provider) WithPoolConfig(poolConfig *PoolConfig) *Provider

func (*Provider) WithTimeoutConfig

func (instance *Provider) WithTimeoutConfig(timeoutConfig *TimeoutConfig) *Provider

type TimeoutConfig

type TimeoutConfig struct {
	ConnectTimeout time.Duration
}

func DefaultTimeoutConfig

func DefaultTimeoutConfig() *TimeoutConfig

Jump to

Keyboard shortcuts

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