deploydb

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package deploydb is the SQLite persistence layer for citadel deployment history. It records every non-dry-run deploy (success or failure) so the `citadel dashboard` command can list them. The database lives at ~/.citadel/deployments.db on the developer's machine.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultPath

func DefaultPath() (string, error)

DefaultPath returns ~/.citadel/deployments.db, creating ~/.citadel if needed.

Types

type DB

type DB struct {
	*sql.DB
}

DB wraps *sql.DB with deployment-history queries.

func Open

func Open(path string) (*DB, error)

Open creates or opens the SQLite database at path and applies the schema. path may be ":memory:" for tests.

func (*DB) Insert

func (d *DB) Insert(ctx context.Context, rec Deployment) (string, error)

Insert writes a new row with status="in_progress" and returns its id.

func (*DB) List

func (d *DB) List(ctx context.Context, f Filter) ([]Deployment, error)

List returns deployments newest-first, optionally filtered.

func (*DB) MarkFailed

func (d *DB) MarkFailed(ctx context.Context, id, errMsg string) error

MarkFailed sets status=failed, records errMsg, and stamps finished_at.

func (*DB) MarkSuccess

func (d *DB) MarkSuccess(ctx context.Context, id string) error

MarkSuccess sets status=success and stamps finished_at/duration_ms.

type Deployment

type Deployment struct {
	ID         string
	Project    string
	Env        string
	Runtime    string
	Region     string
	GitSHA     string
	ImageURI   string
	Message    string
	Status     string
	Error      string
	DeployedBy string
	Target     string
	StartedAt  int64
	FinishedAt *int64
	DurationMS *int64
}

Deployment is a row in the deployments table.

type Filter

type Filter struct {
	Project string
	Env     string
	Limit   int
}

Filter narrows List results. Zero-value fields are ignored.

Jump to

Keyboard shortcuts

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