postgres

package
v0.0.55 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

README

api/sinks/postgres

The PostgreSQL database layer for the API server. Coordinates connection setup, schema execution, and initial data seeding through a single initializer called at startup. Uses a connection pool and runs all writes as explicit transactions.

The schema defines four tables. The scores table is a full append-only archive of every check result, with indexes optimized for queries filtered by team and status or by team, timestamp, and status. The recent_scores table stores only the most recent result per team/box/service combination using a composite primary key, enabling fast current-status lookups without scanning the full archive. The final_scores table holds running pass and total counters per team/box/service for instant aggregate queries without aggregating over the archive. The scoring_users table is the persistent credential store, keyed on team, userlist, and username, so password changes survive API restarts. Subpackages handle scoring queries, user queries, graph data queries, and miscellaneous utilities independently.

Documentation

Overview

Package postgres contains all PostgreSQL databse connection logic and queries. You probably want to import the conn subpackage and run conn.Get()

Index

Constants

This section is empty.

Variables

View Source
var Schema string

Functions

func InitDB

func InitDB(cfg *config.APIConfigSpec) error

InitDB runs all db initialization steps. It creates the datbase connections, sets driver settings, executes the schema, and seeds users.

Types

This section is empty.

Directories

Path Synopsis
Package conn handles the initialization and distribution of the database connection object.
Package conn handles the initialization and distribution of the database connection object.
Package graphs contains database functions for generating visualizations.
Package graphs contains database functions for generating visualizations.
Package users contains the DB functions and all SQL queries involving scoring users.
Package users contains the DB functions and all SQL queries involving scoring users.

Jump to

Keyboard shortcuts

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