Documentation
¶
Overview ¶
Package postgres provides a ready Postgres connection pool for dim: Resource opens it with pg.Open, checks it is reachable and closes it on shutdown.
Usage ¶
// in an app initializer (app.Initializer[Deps]):
c.DB, cleanup = dim.NewResource("Store", postgres.Resource(pg.Config{
User: opts.DB.User,
Password: opts.DB.Password,
Host: opts.DB.Host,
Name: opts.DB.Name,
Metrics: c.Metrics,
TracerProvider: c.TracerProvider,
}))
return cleanup, nil
The pool is opened on first use of c.DB. pg.Config is passed through unchanged: see the dbx/pg package for its fields.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.