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 ¶
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.
Click to show internal directories.
Click to hide internal directories.