store

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 1, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBPool

type DBPool interface {
	Ping(ctx context.Context) error
	Begin(ctx context.Context) (pgx.Tx, error)
	Query(ctx context.Context, sql string, args ...interface{}) (pgx.Rows, error)
	// Add Exec to the interface so we can mock it
	Exec(ctx context.Context, sql string, args ...any) (pgconn.CommandTag, error)
	CopyFrom(ctx context.Context, tableName pgx.Identifier, columnNames []string, rowSrc pgx.CopyFromSource) (int64, error)
}

DBPool is an interface that abstracts the pgxpool.Pool to allow for mocking in tests.

type Store

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

Store provides a PostgreSQL implementation of the Repository interface.

func New

func New(ctx context.Context, pool DBPool, logger *zap.Logger) (*Store, error)

New creates a new store instance and verifies the connection.

func (*Store) GetFindingsByScanID

func (s *Store) GetFindingsByScanID(ctx context.Context, scanID string) ([]schemas.Finding, error)

func (*Store) PersistData

func (s *Store) PersistData(ctx context.Context, envelope *schemas.ResultEnvelope) error

PersistData handles the database transaction for inserting all data from a result envelope.

Jump to

Keyboard shortcuts

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