storage

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package storage provides a persistence layer using SQLite to maintain a history of all deployment attempts and their outcomes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	// ID is the unique auto-incrementing identifier for the record.
	ID int
	// Hash is the Git commit SHA detected for this deployment.
	Hash string
	// Status is the result of the operation (success, failed, or rollback).
	Status string
	// Output is the combined stdout/stderr from the remote execution.
	Output string
	// CreatedAt is the timestamp when the record was inserted.
	CreatedAt time.Time
}

Deployment represents a single record of a deployment attempt in the database.

type Service

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

Service manages the connection pool and SQL operations for the metadata store.

func NewService

func NewService(dbPath string) (*Service, error)

NewService initializes the SQLite database at the specified path, runs internal migrations, and returns a usable Service instance.

func (*Service) Close

func (s *Service) Close() error

Close terminates the underlying database connection.

func (*Service) GetHistory

func (s *Service) GetHistory(limit int) ([]Deployment, error)

GetHistory retrieves the last N deployment records from the database, ordered by their IDs in descending order.

func (*Service) RecordDeploy

func (s *Service) RecordDeploy(hash, status, output string) error

RecordDeploy inserts a new deployment event into the database history.

Jump to

Keyboard shortcuts

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