forgepgx

package module
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package forgepgx provides a [smeldr.DB] adapter for pgx/v5 native connection pools. It bridges pgxpool.Pool to the [smeldr.DB] interface so Forge modules can use pgx's maximum-throughput connection pool without any changes to core Forge code.

Usage

pool, err := pgxpool.New(ctx, os.Getenv("DATABASE_URL"))
if err != nil {
    log.Fatal(err)
}
app := smeldr.New(smeldr.Config{
    BaseURL: "https://example.com",
    Secret:  []byte(os.Getenv("SECRET")),
    DB:      forgepgx.Wrap(pool),
})

See [Decision 22] in DECISIONS.md for performance rationale and driver comparison.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Wrap

func Wrap(p *pgxpool.Pool) smeldr.DB

Wrap returns a [smeldr.DB] backed by the given pgx connection pool.

The pool must not be nil. Wrap calls stdlib.OpenDBFromPool once to create a *sql.DB wrapper; no network connections are established at this point.

pool, _ := pgxpool.New(ctx, os.Getenv("DATABASE_URL"))
db := forgepgx.Wrap(pool)
app := smeldr.New(smeldr.Config{DB: db, ...})

Types

This section is empty.

Jump to

Keyboard shortcuts

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