store

package
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// SchemaVersion is the current database schema version
	SchemaVersion = 1

	// InitialSchema creates the deployments table
	InitialSchema = `` /* 1132-byte string literal not displayed */

)

Variables

View Source
var Migrations = []string{
	InitialSchema,
}

Migrations is a list of schema migrations to apply in order

Functions

This section is empty.

Types

type Deployment

type Deployment struct {
	ID                string
	AppName           string
	UserPrompt        string
	RepoURL           string
	RepoCommitSHA     string
	Strategy          string
	Region            string
	Status            DeploymentStatus
	TerraformStateKey string
	TerraformDir      string

	// LLM information
	LLMProvider string
	LLMModel    string

	// Serialized as JSON
	Analysis      *types.Analysis
	Config        *types.TerraformConfig
	Outputs       map[string]string
	Warnings      []string
	Optimizations []string

	ErrorMessage string

	CreatedAt   time.Time
	UpdatedAt   time.Time
	DeployedAt  *time.Time
	DestroyedAt *time.Time
}

Deployment represents a tracked deployment in the database

type DeploymentFilter

type DeploymentFilter struct {
	Region   string
	Strategy string
	Status   DeploymentStatus
	AppName  string
}

DeploymentFilter represents query filters for deployments

type DeploymentStatus

type DeploymentStatus string

DeploymentStatus represents the current state of a deployment

const (
	DeploymentStatusPending   DeploymentStatus = "pending"
	DeploymentStatusRunning   DeploymentStatus = "running"
	DeploymentStatusSucceeded DeploymentStatus = "succeeded"
	DeploymentStatusFailed    DeploymentStatus = "failed"
	DeploymentStatusDestroyed DeploymentStatus = "destroyed"
)

type SQLiteStore

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

SQLiteStore implements the Store interface using SQLite

func NewSQLiteStore

func NewSQLiteStore(dbPath string) (*SQLiteStore, error)

NewSQLiteStore creates a new SQLite store

func (*SQLiteStore) Close

func (s *SQLiteStore) Close() error

Close closes the database connection

func (*SQLiteStore) Create

func (s *SQLiteStore) Create(ctx context.Context, deployment *Deployment) error

Create creates a new deployment record

func (*SQLiteStore) Delete

func (s *SQLiteStore) Delete(ctx context.Context, id string) error

Delete removes a deployment record

func (*SQLiteStore) Get

func (s *SQLiteStore) Get(ctx context.Context, id string) (*Deployment, error)

Get retrieves a deployment by ID

func (*SQLiteStore) Initialize

func (s *SQLiteStore) Initialize(ctx context.Context) error

Initialize creates tables and runs migrations

func (*SQLiteStore) List

func (s *SQLiteStore) List(ctx context.Context, filter *DeploymentFilter) ([]*Deployment, error)

List retrieves all deployments with optional filtering

func (*SQLiteStore) Update

func (s *SQLiteStore) Update(ctx context.Context, deployment *Deployment) error

Update updates a deployment record

func (*SQLiteStore) UpdateStatus

func (s *SQLiteStore) UpdateStatus(ctx context.Context, id string, status DeploymentStatus, errorMessage string) error

UpdateStatus updates only the status and error message

type Store

type Store interface {
	// Initialize creates tables and runs migrations
	Initialize(ctx context.Context) error

	// Close closes the database connection
	Close() error

	// Create creates a new deployment record
	Create(ctx context.Context, deployment *Deployment) error

	// Get retrieves a deployment by ID
	Get(ctx context.Context, id string) (*Deployment, error)

	// List retrieves all deployments with optional filtering
	List(ctx context.Context, filter *DeploymentFilter) ([]*Deployment, error)

	// Update updates a deployment record
	Update(ctx context.Context, deployment *Deployment) error

	// UpdateStatus updates only the status and error message
	UpdateStatus(ctx context.Context, id string, status DeploymentStatus, errorMessage string) error

	// Delete removes a deployment record
	Delete(ctx context.Context, id string) error
}

Store defines the interface for deployment persistence

Jump to

Keyboard shortcuts

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