postgres

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 27 Imported by: 0

README

Postgres LogStorage

Notes and Caveats

The current LogStorage part of the Postgres implementation was based off what was already written for MySQL. Thus, the two user-defined functions included in storage.sql. MySQL doesn't kill a transaction when a duplicate is detected, but PostgreSQL does. So, to preserve the workflow, I included the two functions which trap this error and allow the code to continue executing. The only other change I made was to fully translate the MySQL queries to PostgreSQL compatible ones and tidy up some of the extant tree storage code.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	PGConnStr string
)

nolint: gochecknoglobals

Functions

func NewAdminStorage

func NewAdminStorage(db *sql.DB) storage.AdminStorage

NewAdminStorage returns a storage.AdminStorage implementation.

func NewLogStorage

func NewLogStorage(db *sql.DB, mf monitoring.MetricFactory) storage.LogStorage

NewLogStorage creates a storage.LogStorage instance for the specified PostgreSQL URL. It assumes storage.AdminStorage is backed by the same PostgreSQL database as well.

func NewPGProvider added in v1.0.0

func NewPGProvider(mf monitoring.MetricFactory) (storage.Provider, error)

NewPGProvider return new pg provider.

func OpenDB

func OpenDB(connStr string) (*sql.DB, error)

OpenDB opens a database connection for all PG-based storage implementations.

Types

type SQLResult

type SQLResult sql.Result

SQLResult is used for mocking.

Directories

Path Synopsis
Package testdb creates new databases for tests.
Package testdb creates new databases for tests.

Jump to

Keyboard shortcuts

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