mirror of
https://github.com/grassrootseconomics/cic-custodial.git
synced 2026-05-27 21:47:55 +02:00
docs: pkg inline
This commit is contained in:
@@ -9,23 +9,15 @@ import (
|
||||
|
||||
type PostgresPoolOpts struct {
|
||||
DSN string
|
||||
// Debug bool
|
||||
// Logg tracelog.Logger
|
||||
}
|
||||
|
||||
// NewPostgresPool creates a reusbale connection pool across the cic-custodial component.
|
||||
func NewPostgresPool(o PostgresPoolOpts) (*pgxpool.Pool, error) {
|
||||
parsedConfig, err := pgxpool.ParseConfig(o.DSN)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// if o.Debug {
|
||||
// parsedConfig.ConnConfig.Tracer = &tracelog.TraceLog{
|
||||
// Logger: o.Logg,
|
||||
// LogLevel: tracelog.LogLevelDebug,
|
||||
// }
|
||||
// }
|
||||
|
||||
dbPool, err := pgxpool.NewWithConfig(context.Background(), parsedConfig)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
Reference in New Issue
Block a user