postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2026 License: AGPL-3.0 Imports: 14 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package postgres provides an interface for writing to a Postgres instance.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ProvideDatabaseClient

func ProvideDatabaseClient(ctx context.Context, logger logging.Logger, tracerProvider tracing.TracerProvider, cfg database.ClientConfig, metricsProvider metrics.Provider) (database.Client, error)

ProvideDatabaseClient provides a new DataManager client. If metricsProvider is non-nil, the DB driver will use it so SQL latency and other db.sql.* metrics are emitted (e.g. db_sql_latency_milliseconds_bucket in Prometheus).

func RegisterDatabaseClient

func RegisterDatabaseClient(i do.Injector)

RegisterDatabaseClient registers a database.Client with the injector. Prerequisite: database.ClientConfig must be registered (e.g. via databasecfg.RegisterClientConfig).

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is the primary database querying client.

func (*Client) Close

func (q *Client) Close() error

Close closes the database connection.

func (*Client) CurrentTime

func (q *Client) CurrentTime() time.Time

func (*Client) IsReady

func (q *Client) IsReady(ctx context.Context) bool

IsReady returns whether the database is ready for the querier.

func (*Client) ReadDB

func (q *Client) ReadDB() *sql.DB

ReadDB provides the database object.

func (*Client) RollbackTransaction

func (q *Client) RollbackTransaction(ctx context.Context, tx database.SQLQueryExecutorAndTransactionManager)

func (*Client) WriteDB

func (q *Client) WriteDB() *sql.DB

WriteDB provides the database object.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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