Documentation ¶
Index ¶
- type Repository
- func (r Repository) Config() *viper.Viper
- func (r Repository) ConnConfig(u string, zlg *zap.Logger, app string) *pgx.ConnConfig
- func (r *Repository) DB() *sqlx.DB
- func (r Repository) DBURL() string
- func (r *Repository) HealthCheck() error
- func (r Repository) LogLevel() tracelog.LogLevel
- func (r Repository) Logger() log.Factory
- func (r *Repository) Sample() repos.SampleRepo
- func (r Repository) SetPool(db *sql.DB)
- func (r *Repository) Start() error
- func (r *Repository) Stop() error
- func (r Repository) TraceOptions(u string) []ocsql.TraceOption
- func (r Repository) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository knows how to handle a postgres backend database.
The database driver is instrumented for tracing.
func NewRepository ¶
NewRepository creates a new postgres repository.
The new repository needs to be started wih Start() in order to create the connection pools.
func (Repository) Config ¶
func (r Repository) Config() *viper.Viper
Config returns a configuration registry
func (Repository) ConnConfig ¶
func (*Repository) HealthCheck ¶
func (r *Repository) HealthCheck() error
HealthCheck pings the database
func (*Repository) Sample ¶
func (r *Repository) Sample() repos.SampleRepo
func (*Repository) Start ¶
func (r *Repository) Start() error
Start a connection pool to a database, plus possibly another one to the read-only version of it
func (*Repository) Stop ¶
func (r *Repository) Stop() error
Stop the repository and close all connection pools.
Stop may be called safely even if the database connection failed to start properly.
func (Repository) TraceOptions ¶
func (r Repository) TraceOptions(u string) []ocsql.TraceOption
TraceOptions returns the trace options for the opencensus driver wrapper
Click to show internal directories.
Click to hide internal directories.