sqlite

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2026 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTestDB added in v0.1.2

func NewTestDB(t *testing.T) *sql.DB

NewTestDB creates an in-memory SQLite database with all migrations applied. The database is automatically closed when the test completes.

Types

type DB

type DB interface {
	sqlc.DBTX
	tx.SQLiteTxer
}

DB is the interface required by the sqlite package for database access. It is satisfied by *sql.DB.

type EpicRepository

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

EpicRepository implements epic.Repository using SQLite.

func NewEpicRepository

func NewEpicRepository(db DB) *EpicRepository

NewEpicRepository creates a new EpicRepository backed by the given SQLite DB.

func (*EpicRepository) AppendSessionLog

func (r *EpicRepository) AppendSessionLog(ctx context.Context, id epic.EpicID, lines []string) error

func (*EpicRepository) ClaimEpic

func (r *EpicRepository) ClaimEpic(ctx context.Context, id epic.EpicID) (bool, error)

func (*EpicRepository) ClearEpicFeedback

func (r *EpicRepository) ClearEpicFeedback(ctx context.Context, id epic.EpicID) error

func (*EpicRepository) CreateEpic

func (r *EpicRepository) CreateEpic(ctx context.Context, e *epic.Epic) error

func (*EpicRepository) DeleteEpic

func (r *EpicRepository) DeleteEpic(ctx context.Context, id epic.EpicID) error

func (*EpicRepository) EpicHeartbeat

func (r *EpicRepository) EpicHeartbeat(ctx context.Context, id epic.EpicID) error

func (*EpicRepository) ListActiveEpics

func (r *EpicRepository) ListActiveEpics(ctx context.Context) ([]*epic.Epic, error)

func (*EpicRepository) ListEpics

func (r *EpicRepository) ListEpics(ctx context.Context) ([]*epic.Epic, error)

func (*EpicRepository) ListEpicsByRepo

func (r *EpicRepository) ListEpicsByRepo(ctx context.Context, repoID string) ([]*epic.Epic, error)

func (*EpicRepository) ListPlanningEpics

func (r *EpicRepository) ListPlanningEpics(ctx context.Context) ([]*epic.Epic, error)

func (*EpicRepository) ListStaleEpics

func (r *EpicRepository) ListStaleEpics(ctx context.Context, threshold time.Time) ([]*epic.Epic, error)

func (*EpicRepository) ReadEpic

func (r *EpicRepository) ReadEpic(ctx context.Context, id epic.EpicID) (*epic.Epic, error)

func (*EpicRepository) ReleaseEpicClaim

func (r *EpicRepository) ReleaseEpicClaim(ctx context.Context, id epic.EpicID) error

func (*EpicRepository) RemoveTaskID

func (r *EpicRepository) RemoveTaskID(ctx context.Context, id epic.EpicID, taskID string) error

func (*EpicRepository) SetEpicFeedback

func (r *EpicRepository) SetEpicFeedback(ctx context.Context, id epic.EpicID, feedback, feedbackType string) error

func (*EpicRepository) SetTaskIDs

func (r *EpicRepository) SetTaskIDs(ctx context.Context, id epic.EpicID, taskIDs []string) error

func (*EpicRepository) UpdateEpic

func (r *EpicRepository) UpdateEpic(ctx context.Context, e *epic.Epic) error

func (*EpicRepository) UpdateEpicStatus

func (r *EpicRepository) UpdateEpicStatus(ctx context.Context, id epic.EpicID, status epic.Status) error

func (*EpicRepository) UpdateProposedTasks

func (r *EpicRepository) UpdateProposedTasks(ctx context.Context, id epic.EpicID, tasks []epic.ProposedTask) error

type GitHubTokenRepository

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

GitHubTokenRepository implements githubtoken.Repository using SQLite.

func NewGitHubTokenRepository

func NewGitHubTokenRepository(dbtx DB) *GitHubTokenRepository

NewGitHubTokenRepository creates a new GitHubTokenRepository backed by the given SQLite DB.

func (*GitHubTokenRepository) DeleteGitHubToken

func (r *GitHubTokenRepository) DeleteGitHubToken(ctx context.Context) error

func (*GitHubTokenRepository) ReadGitHubToken

func (r *GitHubTokenRepository) ReadGitHubToken(ctx context.Context) (string, error)

func (*GitHubTokenRepository) UpsertGitHubToken

func (r *GitHubTokenRepository) UpsertGitHubToken(ctx context.Context, encryptedToken string, now time.Time) error

type RepoRepository

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

RepoRepository implements repo.Repository using SQLite.

func NewRepoRepository

func NewRepoRepository(db DB) *RepoRepository

NewRepoRepository creates a new RepoRepository backed by the given SQLite DB.

func (*RepoRepository) CreateRepo

func (r *RepoRepository) CreateRepo(ctx context.Context, rp *repo.Repo) error

func (*RepoRepository) DeleteRepo

func (r *RepoRepository) DeleteRepo(ctx context.Context, id repo.RepoID) error

func (*RepoRepository) ListRepos

func (r *RepoRepository) ListRepos(ctx context.Context) ([]*repo.Repo, error)

func (*RepoRepository) ReadRepo

func (r *RepoRepository) ReadRepo(ctx context.Context, id repo.RepoID) (*repo.Repo, error)

func (*RepoRepository) ReadRepoByFullName

func (r *RepoRepository) ReadRepoByFullName(ctx context.Context, fullName string) (*repo.Repo, error)

type SettingRepository

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

SettingRepository implements setting.Repository using SQLite.

func NewSettingRepository

func NewSettingRepository(db DB) *SettingRepository

NewSettingRepository creates a new SettingRepository backed by the given SQLite DB.

func (*SettingRepository) DeleteSetting

func (r *SettingRepository) DeleteSetting(ctx context.Context, key string) error

func (*SettingRepository) ListSettings

func (r *SettingRepository) ListSettings(ctx context.Context) (map[string]string, error)

func (*SettingRepository) ReadSetting

func (r *SettingRepository) ReadSetting(ctx context.Context, key string) (string, error)

func (*SettingRepository) UpsertSetting

func (r *SettingRepository) UpsertSetting(ctx context.Context, key, value string) error

type TaskRepoOption added in v0.1.2

type TaskRepoOption func(*tx.SQLiteRepositoryTxerConfig[task.Repository])

TaskRepoOption configures a TaskRepository.

func WithNoPragma added in v0.1.2

func WithNoPragma() TaskRepoOption

WithNoPragma disables PRAGMA statements inside transactions. Use this for SQLite drivers or backends that do not support PRAGMAs (e.g. Turso/libSQL).

type TaskRepository

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

TaskRepository implements task.Repository using SQLite.

func NewTaskRepository

func NewTaskRepository(db DB, opts ...TaskRepoOption) *TaskRepository

NewTaskRepository creates a new TaskRepository backed by the given SQLite DB.

func (*TaskRepository) AddCost

func (r *TaskRepository) AddCost(ctx context.Context, id task.TaskID, costUSD float64) error

func (*TaskRepository) AppendTaskLogs

func (r *TaskRepository) AppendTaskLogs(ctx context.Context, id task.TaskID, attempt int, logs []string) error

func (*TaskRepository) BeginTxFunc

func (r *TaskRepository) BeginTxFunc(ctx context.Context, fn func(ctx context.Context, txn tx.Tx, repo task.Repository) error) error

func (*TaskRepository) BulkCloseTasksByEpic

func (r *TaskRepository) BulkCloseTasksByEpic(ctx context.Context, epicID, reason string) error

func (*TaskRepository) BulkDeleteTasksByEpic

func (r *TaskRepository) BulkDeleteTasksByEpic(ctx context.Context, epicID string) error

func (*TaskRepository) BulkDeleteTasksByIDs

func (r *TaskRepository) BulkDeleteTasksByIDs(ctx context.Context, ids []string) error

func (*TaskRepository) ClaimTask

func (r *TaskRepository) ClaimTask(ctx context.Context, id task.TaskID) (bool, error)

func (*TaskRepository) ClearEpicIDForTasks

func (r *TaskRepository) ClearEpicIDForTasks(ctx context.Context, epicID string) error

func (*TaskRepository) CloseTask

func (r *TaskRepository) CloseTask(ctx context.Context, id task.TaskID, reason string) error

func (*TaskRepository) CreateTask

func (r *TaskRepository) CreateTask(ctx context.Context, t *task.Task) error

func (*TaskRepository) DeleteExpiredLogs

func (r *TaskRepository) DeleteExpiredLogs(ctx context.Context, before time.Time) (int64, error)

func (*TaskRepository) DeleteTask

func (r *TaskRepository) DeleteTask(ctx context.Context, id task.TaskID) error

func (*TaskRepository) DeleteTaskLogs

func (r *TaskRepository) DeleteTaskLogs(ctx context.Context, id task.TaskID) error

func (*TaskRepository) FeedbackRetryTask

func (r *TaskRepository) FeedbackRetryTask(ctx context.Context, id task.TaskID, feedback string) (bool, error)

func (*TaskRepository) HasTasksForRepo

func (r *TaskRepository) HasTasksForRepo(ctx context.Context, repoID string) (bool, error)

func (*TaskRepository) Heartbeat

func (r *TaskRepository) Heartbeat(ctx context.Context, id task.TaskID) (bool, error)

func (*TaskRepository) ListPendingTasks

func (r *TaskRepository) ListPendingTasks(ctx context.Context) ([]*task.Task, error)

func (*TaskRepository) ListPendingTasksByRepos

func (r *TaskRepository) ListPendingTasksByRepos(ctx context.Context, repoIDs []string) ([]*task.Task, error)

ListPendingTasksByRepos returns pending tasks filtered by repo IDs. SQLite doesn't support ANY($1::text[]), so we build the query dynamically.

func (*TaskRepository) ListStaleTasks

func (r *TaskRepository) ListStaleTasks(ctx context.Context, before time.Time) ([]*task.Task, error)

func (*TaskRepository) ListTasks

func (r *TaskRepository) ListTasks(ctx context.Context) ([]*task.Task, error)

func (*TaskRepository) ListTasksByEpic

func (r *TaskRepository) ListTasksByEpic(ctx context.Context, epicID string) ([]*task.Task, error)

func (*TaskRepository) ListTasksByRepo

func (r *TaskRepository) ListTasksByRepo(ctx context.Context, repoID string) ([]*task.Task, error)

func (*TaskRepository) ListTasksInReview

func (r *TaskRepository) ListTasksInReview(ctx context.Context) ([]*task.Task, error)

func (*TaskRepository) ListTasksInReviewByRepo

func (r *TaskRepository) ListTasksInReviewByRepo(ctx context.Context, repoID string) ([]*task.Task, error)

func (*TaskRepository) ListTasksInReviewNoPR

func (r *TaskRepository) ListTasksInReviewNoPR(ctx context.Context) ([]*task.Task, error)

func (*TaskRepository) ManualRetryTask

func (r *TaskRepository) ManualRetryTask(ctx context.Context, id task.TaskID, instructions string) (bool, error)

func (*TaskRepository) ReadTask

func (r *TaskRepository) ReadTask(ctx context.Context, id task.TaskID) (*task.Task, error)

func (*TaskRepository) ReadTaskLogs

func (r *TaskRepository) ReadTaskLogs(ctx context.Context, id task.TaskID) ([]string, error)

func (*TaskRepository) ReadTaskStatus

func (r *TaskRepository) ReadTaskStatus(ctx context.Context, id task.TaskID) (task.Status, error)

func (*TaskRepository) RemoveDependency

func (r *TaskRepository) RemoveDependency(ctx context.Context, id task.TaskID, depID string) error

func (*TaskRepository) RetryTask

func (r *TaskRepository) RetryTask(ctx context.Context, id task.TaskID, reason string) (bool, error)

func (*TaskRepository) ScheduleRetryFromRunning

func (r *TaskRepository) ScheduleRetryFromRunning(ctx context.Context, id task.TaskID, reason string) (bool, error)

func (*TaskRepository) SetAgentStatus

func (r *TaskRepository) SetAgentStatus(ctx context.Context, id task.TaskID, status string) error

func (*TaskRepository) SetBranchName

func (r *TaskRepository) SetBranchName(ctx context.Context, id task.TaskID, branchName string) error

func (*TaskRepository) SetCloseReason

func (r *TaskRepository) SetCloseReason(ctx context.Context, id task.TaskID, reason string) error

func (*TaskRepository) SetConsecutiveFailures

func (r *TaskRepository) SetConsecutiveFailures(ctx context.Context, id task.TaskID, count int) error

func (*TaskRepository) SetReady

func (r *TaskRepository) SetReady(ctx context.Context, id task.TaskID, ready bool) error

func (*TaskRepository) SetRetryContext

func (r *TaskRepository) SetRetryContext(ctx context.Context, id task.TaskID, retryCtx string) error

func (*TaskRepository) SetTaskPullRequest

func (r *TaskRepository) SetTaskPullRequest(ctx context.Context, id task.TaskID, prURL string, prNumber int) error

func (*TaskRepository) StartOverTask

func (r *TaskRepository) StartOverTask(ctx context.Context, id task.TaskID, params task.StartOverTaskParams) (bool, error)

func (*TaskRepository) StopTask

func (r *TaskRepository) StopTask(ctx context.Context, id task.TaskID, reason string) (bool, error)

func (*TaskRepository) StreamTaskLogs

func (r *TaskRepository) StreamTaskLogs(ctx context.Context, id task.TaskID, fn func(attempt int, lines []string) error) error

func (*TaskRepository) TaskExists

func (r *TaskRepository) TaskExists(ctx context.Context, id task.TaskID) (bool, error)

func (*TaskRepository) UpdatePendingTask

func (r *TaskRepository) UpdatePendingTask(ctx context.Context, id task.TaskID, params task.UpdatePendingTaskParams) (bool, error)

func (*TaskRepository) UpdateTaskStatus

func (r *TaskRepository) UpdateTaskStatus(ctx context.Context, id task.TaskID, status task.Status) error

func (*TaskRepository) WithTx

func (r *TaskRepository) WithTx(txn tx.Tx) task.Repository

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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