postgres

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Overview

Package postgres implements the indexer store interface for a PostgreSQL database.

SQL statements should be arranged in this package such that they're constants in the closest scope possible to where they're used. They should be run through sqlfmt and then checked for correctness, as sqlfmt doesn't fully understand the PostgreSQL dialect. Queries should endeavor to do work database-side, as opposed to making queries to construct further queries.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNotIndexed indicates the vulnerability being queried has a dist or repo not
	// indexed into the database.
	ErrNotIndexed = fmt.Errorf("vulnerability containers data not indexed by any scannners")
)

Functions

func NewStore

func NewStore(pool *pgxpool.Pool) *store

func TestDatabase added in v0.2.0

func TestDatabase(ctx context.Context, t testing.TB) *pgxpool.Pool

Types

This section is empty.

Notes

Bugs

  • TestDatabase closes over the passed-in Context and uses it for the Cleanup method. Because Cleanup functions are earlier in the stack than any defers inside the test, make sure the Context isn't one that's deferred to be cancelled.

Jump to

Keyboard shortcuts

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