db

package
v0.0.0-...-01651bc Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package db provides a SQLite-backed persistence layer for the deploy tool.

It stores deployment execution records (status, output, timestamps) and user-defined key-value configuration. The database is created automatically on first use and migrations are applied on Open.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

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

DB wraps the SQLite connection.

func Open

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

Open opens (or creates) the SQLite database at the given path and runs migrations.

func (*DB) Close

func (d *DB) Close() error

Close closes the database connection.

func (*DB) DeleteConfig

func (d *DB) DeleteConfig(key string) error

DeleteConfig removes a config key.

func (*DB) GetConfig

func (d *DB) GetConfig(key string) (*types.ConfigEntry, error)

GetConfig retrieves a config value by key.

func (*DB) GetDeployment

func (d *DB) GetDeployment(id int64) (*types.DeploymentRecord, error)

GetDeployment returns a deployment by ID.

func (*DB) InsertDeployment

func (d *DB) InsertDeployment(name, hash, description, filePath, pluginName string) (int64, error)

InsertDeployment creates a new deployment record and returns its ID.

func (*DB) ListConfig

func (d *DB) ListConfig() ([]types.ConfigEntry, error)

ListConfig returns all config entries.

func (*DB) ListPlugins

func (d *DB) ListPlugins() ([]types.PluginRecord, error)

ListPlugins returns all registered plugins.

func (*DB) QueryDeployments

func (d *DB) QueryDeployments(filter string) ([]types.DeploymentRecord, error)

QueryDeployments searches deployments by an optional filter (name, hash, status, or description substring).

func (*DB) SetConfig

func (d *DB) SetConfig(key, value string) error

SetConfig sets a key-value pair.

func (*DB) TouchPluginUsed

func (d *DB) TouchPluginUsed(name string) error

TouchPluginUsed updates the last_used_at timestamp for a plugin.

func (*DB) UpdateDeploymentStatus

func (d *DB) UpdateDeploymentStatus(id int64, status, output string) error

UpdateDeploymentStatus sets the final status and output of a deployment.

func (*DB) UpsertPlugin

func (d *DB) UpsertPlugin(name, source, version, execPath string) error

UpsertPlugin records a plugin, updating it if it already exists.

Jump to

Keyboard shortcuts

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