postgrespresets

package
v0.20.7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// CreateSchema is the SQL statement used to create a schema in PostgreSQL.
	//
	// We use fmt rather than query arguments because sanitization
	// does not expect schema names to be passed as arguments.
	CreateSchema = "CREATE SCHEMA IF NOT EXISTS %s;"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

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

func NewDefault

func NewDefault(options ...pgdriver.Option) *Default

func (*Default) DB

func (config *Default) DB(ctx context.Context) (*bun.DB, error)

DB returns the main database connection.

func (*Default) DBSchema

func (config *Default) DBSchema(ctx context.Context, schema string, create bool) (*bun.DB, error)

DBSchema returns a database connection for the specified schema. It smartly caches and reuses connections for any given schema name.

If the `create` parameter is true, and no connection exists for the specified schema, it will create the schema in the database before returning the connection.

func (*Default) Options

func (config *Default) Options() []pgdriver.Option

Jump to

Keyboard shortcuts

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