sqlite

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 21, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package sqlite provides SQLite implementations of the repository interfaces.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTransacter

func NewTransacter(db *sqlx.DB) atomic.Transacter[repository.Resources]

NewTransacter creates a transacter backed by the given DB.

func ResourcesFactory

ResourcesFactory creates transaction-bound repositories from a transaction handle.

Types

type AgentSessionRepo added in v0.1.0

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

AgentSessionRepo implements repository.AgentSessionRepository using SQLite.

func NewAgentSessionRepo added in v0.1.0

func NewAgentSessionRepo(remote generic.SQLXRemote) AgentSessionRepo

func (AgentSessionRepo) Create added in v0.1.0

func (AgentSessionRepo) Delete added in v0.1.0

func (r AgentSessionRepo) Delete(ctx context.Context, id string) error

func (AgentSessionRepo) Get added in v0.1.0

func (AgentSessionRepo) ListByOwnerInstanceID added in v0.1.0

func (r AgentSessionRepo) ListByOwnerInstanceID(ctx context.Context, instanceID string) ([]domain.AgentSession, error)

func (AgentSessionRepo) ListBySubPlanID added in v0.1.0

func (r AgentSessionRepo) ListBySubPlanID(ctx context.Context, subPlanID string) ([]domain.AgentSession, error)

func (AgentSessionRepo) ListByWorkItemID added in v0.1.0

func (r AgentSessionRepo) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.AgentSession, error)

func (AgentSessionRepo) ListByWorkspaceID added in v0.1.0

func (r AgentSessionRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.AgentSession, error)

func (AgentSessionRepo) SearchHistory added in v0.1.0

func (AgentSessionRepo) Update added in v0.1.0

type EventRepo

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

EventRepo implements repository.EventRepository using SQLite.

func NewEventRepo

func NewEventRepo(remote generic.SQLXRemote) EventRepo

func (EventRepo) Create

func (r EventRepo) Create(ctx context.Context, e domain.SystemEvent) error

Create persists a system event with automatic retry on SQLITE_BUSY. This handles concurrent database access without requiring transaction coordination.

func (EventRepo) ListByType

func (r EventRepo) ListByType(ctx context.Context, eventType string, limit int) ([]domain.SystemEvent, error)

func (EventRepo) ListByWorkspaceID

func (r EventRepo) ListByWorkspaceID(ctx context.Context, workspaceID string, limit int) ([]domain.SystemEvent, error)

type GithubPRCheckRepo added in v0.0.28

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

GithubPRCheckRepo implements repository.GithubPRCheckRepository using SQLite.

func NewGithubPRCheckRepo added in v0.0.28

func NewGithubPRCheckRepo(remote generic.SQLXRemote) GithubPRCheckRepo

func (GithubPRCheckRepo) DeleteByPRID added in v0.0.28

func (r GithubPRCheckRepo) DeleteByPRID(ctx context.Context, prID string) error

func (GithubPRCheckRepo) ListByPRID added in v0.0.28

func (r GithubPRCheckRepo) ListByPRID(ctx context.Context, prID string) ([]domain.GithubPRCheck, error)

func (GithubPRCheckRepo) Upsert added in v0.0.28

type GithubPRRepo

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

GithubPRRepo implements repository.GithubPullRequestRepository using SQLite.

func NewGithubPRRepo

func NewGithubPRRepo(remote generic.SQLXRemote) GithubPRRepo

func (GithubPRRepo) Get

func (GithubPRRepo) GetByNumber

func (r GithubPRRepo) GetByNumber(ctx context.Context, owner, repo string, number int) (domain.GithubPullRequest, error)

func (GithubPRRepo) ListByWorkspaceID

func (r GithubPRRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)

func (GithubPRRepo) ListNonTerminal

func (r GithubPRRepo) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GithubPullRequest, error)

func (GithubPRRepo) Upsert

type GithubPRReviewRepo added in v0.0.28

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

GithubPRReviewRepo implements repository.GithubPRReviewRepository using SQLite.

func NewGithubPRReviewRepo added in v0.0.28

func NewGithubPRReviewRepo(remote generic.SQLXRemote) GithubPRReviewRepo

func (GithubPRReviewRepo) DeleteByPRID added in v0.0.28

func (r GithubPRReviewRepo) DeleteByPRID(ctx context.Context, prID string) error

func (GithubPRReviewRepo) ListByPRID added in v0.0.28

func (r GithubPRReviewRepo) ListByPRID(ctx context.Context, prID string) ([]domain.GithubPRReview, error)

func (GithubPRReviewRepo) Upsert added in v0.0.28

type GitlabMRCheckRepo added in v0.0.28

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

GitlabMRCheckRepo implements repository.GitlabMRCheckRepository using SQLite.

func NewGitlabMRCheckRepo added in v0.0.28

func NewGitlabMRCheckRepo(remote generic.SQLXRemote) GitlabMRCheckRepo

func (GitlabMRCheckRepo) DeleteByMRID added in v0.0.28

func (r GitlabMRCheckRepo) DeleteByMRID(ctx context.Context, mrID string) error

func (GitlabMRCheckRepo) ListByMRID added in v0.0.28

func (r GitlabMRCheckRepo) ListByMRID(ctx context.Context, mrID string) ([]domain.GitlabMRCheck, error)

func (GitlabMRCheckRepo) Upsert added in v0.0.28

type GitlabMRRepo

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

GitlabMRRepo implements repository.GitlabMergeRequestRepository using SQLite.

func NewGitlabMRRepo

func NewGitlabMRRepo(remote generic.SQLXRemote) GitlabMRRepo

func (GitlabMRRepo) Delete added in v0.1.0

func (r GitlabMRRepo) Delete(ctx context.Context, id string) error

func (GitlabMRRepo) Get

func (GitlabMRRepo) GetByIID

func (r GitlabMRRepo) GetByIID(ctx context.Context, projectPath string, iid int) (domain.GitlabMergeRequest, error)

func (GitlabMRRepo) ListByWorkspaceID

func (r GitlabMRRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)

func (GitlabMRRepo) ListNonTerminal

func (r GitlabMRRepo) ListNonTerminal(ctx context.Context, workspaceID string) ([]domain.GitlabMergeRequest, error)

func (GitlabMRRepo) Upsert

type GitlabMRReviewRepo added in v0.0.28

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

GitlabMRReviewRepo implements repository.GitlabMRReviewRepository using SQLite.

func NewGitlabMRReviewRepo added in v0.0.28

func NewGitlabMRReviewRepo(remote generic.SQLXRemote) GitlabMRReviewRepo

func (GitlabMRReviewRepo) DeleteByMRID added in v0.0.28

func (r GitlabMRReviewRepo) DeleteByMRID(ctx context.Context, mrID string) error

func (GitlabMRReviewRepo) ListByMRID added in v0.0.28

func (r GitlabMRReviewRepo) ListByMRID(ctx context.Context, mrID string) ([]domain.GitlabMRReview, error)

func (GitlabMRReviewRepo) Upsert added in v0.0.28

type InstanceRepo

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

InstanceRepo implements repository.InstanceRepository using SQLite.

func NewInstanceRepo

func NewInstanceRepo(remote generic.SQLXRemote) InstanceRepo

func (InstanceRepo) Create

func (InstanceRepo) Delete

func (r InstanceRepo) Delete(ctx context.Context, id string) error

func (InstanceRepo) Get

func (InstanceRepo) ListByWorkspaceID

func (r InstanceRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SubstrateInstance, error)

func (InstanceRepo) Update

type PlanRepo

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

PlanRepo implements repository.PlanRepository using SQLite.

func NewPlanRepo

func NewPlanRepo(remote generic.SQLXRemote) PlanRepo

func (PlanRepo) AppendFAQ

func (r PlanRepo) AppendFAQ(ctx context.Context, entry domain.FAQEntry) error

AppendFAQ atomically appends a new FAQ entry to the plan's FAQ list. Uses a single UPDATE with SQLite JSON functions to avoid read-modify-write races.

func (PlanRepo) Create

func (r PlanRepo) Create(ctx context.Context, p domain.Plan) error

func (PlanRepo) Delete

func (r PlanRepo) Delete(ctx context.Context, id string) error

func (PlanRepo) Get

func (r PlanRepo) Get(ctx context.Context, id string) (domain.Plan, error)

func (PlanRepo) GetByWorkItemID

func (r PlanRepo) GetByWorkItemID(ctx context.Context, workItemID string) (domain.Plan, error)

func (PlanRepo) Update

func (r PlanRepo) Update(ctx context.Context, p domain.Plan) error

type QuestionRepo

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

QuestionRepo implements repository.QuestionRepository using SQLite.

func NewQuestionRepo

func NewQuestionRepo(remote generic.SQLXRemote) QuestionRepo

func (QuestionRepo) Create

func (r QuestionRepo) Create(ctx context.Context, q domain.Question) error

func (QuestionRepo) Get

func (QuestionRepo) ListBySessionID

func (r QuestionRepo) ListBySessionID(ctx context.Context, sessionID string) ([]domain.Question, error)

func (QuestionRepo) Update

func (r QuestionRepo) Update(ctx context.Context, q domain.Question) error

func (QuestionRepo) UpdateProposedAnswer

func (r QuestionRepo) UpdateProposedAnswer(ctx context.Context, id, proposedAnswer string) error

UpdateProposedAnswer atomically updates proposed_answer only when the question is still in the 'escalated' state. If the question was already answered (concurrent ResolveEscalated), the conditional WHERE clause makes this a no-op (0 rows affected), which is treated as success — the sub-agent is already unblocked.

type ReviewRepo

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

ReviewRepo implements repository.ReviewRepository using SQLite.

func NewReviewRepo

func NewReviewRepo(remote generic.SQLXRemote) ReviewRepo

func (ReviewRepo) CreateCritique

func (r ReviewRepo) CreateCritique(ctx context.Context, c domain.Critique) error

func (ReviewRepo) CreateCycle

func (r ReviewRepo) CreateCycle(ctx context.Context, rc domain.ReviewCycle) error

func (ReviewRepo) GetCritique

func (r ReviewRepo) GetCritique(ctx context.Context, id string) (domain.Critique, error)

func (ReviewRepo) GetCycle

func (r ReviewRepo) GetCycle(ctx context.Context, id string) (domain.ReviewCycle, error)

func (ReviewRepo) ListCritiquesByReviewCycleID

func (r ReviewRepo) ListCritiquesByReviewCycleID(ctx context.Context, cycleID string) ([]domain.Critique, error)

func (ReviewRepo) ListCyclesBySessionID

func (r ReviewRepo) ListCyclesBySessionID(ctx context.Context, sessionID string) ([]domain.ReviewCycle, error)

func (ReviewRepo) UpdateCritique

func (r ReviewRepo) UpdateCritique(ctx context.Context, c domain.Critique) error

func (ReviewRepo) UpdateCycle

func (r ReviewRepo) UpdateCycle(ctx context.Context, rc domain.ReviewCycle) error

type SessionFilterLockRepo

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

SessionFilterLockRepo implements repository.NewSessionFilterLockRepository using SQLite.

func NewSessionFilterLockRepo

func NewSessionFilterLockRepo(remote generic.SQLXRemote) SessionFilterLockRepo

NewSessionFilterLockRepo creates a lock repository for New Session filters.

func (SessionFilterLockRepo) Acquire

func (SessionFilterLockRepo) Get

func (SessionFilterLockRepo) Release

func (r SessionFilterLockRepo) Release(ctx context.Context, filterID, instanceID string) error

func (SessionFilterLockRepo) Renew

type SessionFilterRepo

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

SessionFilterRepo implements repository.NewSessionFilterRepository using SQLite.

func NewSessionFilterRepo

func NewSessionFilterRepo(remote generic.SQLXRemote) SessionFilterRepo

NewSessionFilterRepo creates a repository for saved New Session filters.

func (SessionFilterRepo) Create

func (SessionFilterRepo) Delete

func (r SessionFilterRepo) Delete(ctx context.Context, id string) error

func (SessionFilterRepo) Get

func (SessionFilterRepo) GetByWorkspaceProviderName

func (r SessionFilterRepo) GetByWorkspaceProviderName(ctx context.Context, workspaceID, provider, name string) (domain.NewSessionFilter, error)

func (SessionFilterRepo) ListByWorkspaceID

func (r SessionFilterRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.NewSessionFilter, error)

func (SessionFilterRepo) ListByWorkspaceProvider

func (r SessionFilterRepo) ListByWorkspaceProvider(ctx context.Context, workspaceID, provider string) ([]domain.NewSessionFilter, error)

func (SessionFilterRepo) Update

type SessionRepo

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

SessionRepo implements repository.WorkItemRepository using SQLite.

func NewSessionRepo

func NewSessionRepo(remote generic.SQLXRemote) SessionRepo

NewSessionRepo creates a new WorkItemRepo.

func (SessionRepo) Create

func (r SessionRepo) Create(ctx context.Context, item domain.Session) error

func (SessionRepo) Delete

func (r SessionRepo) Delete(ctx context.Context, id string) error

func (SessionRepo) Get

func (r SessionRepo) Get(ctx context.Context, id string) (domain.Session, error)

func (SessionRepo) List

func (SessionRepo) Update

func (r SessionRepo) Update(ctx context.Context, item domain.Session) error

type SessionReviewArtifactRepo

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

SessionReviewArtifactRepo implements repository.SessionReviewArtifactRepository using SQLite.

func NewSessionReviewArtifactRepo

func NewSessionReviewArtifactRepo(remote generic.SQLXRemote) SessionReviewArtifactRepo

func (SessionReviewArtifactRepo) ListByWorkItemID

func (r SessionReviewArtifactRepo) ListByWorkItemID(ctx context.Context, workItemID string) ([]domain.SessionReviewArtifact, error)

func (SessionReviewArtifactRepo) ListByWorkspaceID

func (r SessionReviewArtifactRepo) ListByWorkspaceID(ctx context.Context, workspaceID string) ([]domain.SessionReviewArtifact, error)
func (r SessionReviewArtifactRepo) TransferArtifactLinks(ctx context.Context, fromID, toID string) error

TransferArtifactLinks moves all session_review_artifacts from one provider_artifact_id to another. This is used when correcting duplicate MR/PR records to preserve session links.

func (SessionReviewArtifactRepo) Upsert

type SubPlanRepo

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

SubPlanRepo implements repository.SubPlanRepository using SQLite.

func NewSubPlanRepo

func NewSubPlanRepo(remote generic.SQLXRemote) SubPlanRepo

func (SubPlanRepo) Create

func (r SubPlanRepo) Create(ctx context.Context, sp domain.TaskPlan) error

func (SubPlanRepo) Delete

func (r SubPlanRepo) Delete(ctx context.Context, id string) error

func (SubPlanRepo) Get

func (SubPlanRepo) GetForUpdate added in v0.1.0

func (r SubPlanRepo) GetForUpdate(ctx context.Context, id string) (domain.TaskPlan, error)

GetForUpdate retrieves a sub-plan with a row lock for idempotency checks. Note: modernc.org/sqlite does not support FOR UPDATE, so we use a regular SELECT. SQLite's default locking (BEGIN IMMEDIATE for writes) provides sufficient isolation for our use case.

func (SubPlanRepo) ListByPlanID

func (r SubPlanRepo) ListByPlanID(ctx context.Context, planID string) ([]domain.TaskPlan, error)

func (SubPlanRepo) Update

func (r SubPlanRepo) Update(ctx context.Context, sp domain.TaskPlan) error

type WorkspaceRepo

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

WorkspaceRepo implements repository.WorkspaceRepository using SQLite.

func NewWorkspaceRepo

func NewWorkspaceRepo(remote generic.SQLXRemote) WorkspaceRepo

func (WorkspaceRepo) Create

func (r WorkspaceRepo) Create(ctx context.Context, ws domain.Workspace) error

func (WorkspaceRepo) Delete

func (r WorkspaceRepo) Delete(ctx context.Context, id string) error

func (WorkspaceRepo) Get

func (WorkspaceRepo) Update

func (r WorkspaceRepo) Update(ctx context.Context, ws domain.Workspace) error

Jump to

Keyboard shortcuts

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