pgrepo

package
v0.0.0-...-132c30d Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package pgrepo provides a postgres implementation of the repos.Iface interface.

It builds a configurable connection pool to a postgres database, with an instrumented driver for tracing.

Index

Constants

View Source
const (
	DefaultURL = pgpool.DefaultURL
	DefaultDB  = pgpool.DefaultDBAlias
)

Variables

This section is empty.

Functions

func DefaultSettings

func DefaultSettings() *viper.Viper

DefaultSettings returns all defaults for this package as a viper register.

This is primarily intended for documentation & help purpose.

func EnsureDB

func EnsureDB(ctx context.Context, cfg *viper.Viper, l *zap.Logger, dbName string) (db *sqlx.DB, created bool, err error)

Types

type Repository

type Repository struct {
	*pgpool.Repository
	// contains filtered or unexported fields
}

Repository knows how to handle a postgres backend database.

The database driver is instrumented for tracing.

func New

func New(app string, lg log.Factory, cfg *viper.Viper) *Repository

New new postgres repository serving Messages.

The new repository needs to be started wih Start() in order to create the connection pools.

func (*Repository) Messages

func (r *Repository) Messages() repos.MessageRepo

func (*Repository) Start

func (r *Repository) Start() error

Jump to

Keyboard shortcuts

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