Documentation
¶
Overview ¶
Package repository provides data access interfaces and implementations.
Package repository provides data access interfaces following SOLID principles.
Package repository provides data access interfaces following SOLID principles.
Package repository provides data access implementations for the Simple Easy Tasks application.
Package repository defines data access interfaces and implementations for the domain entities.
Index ¶
- Constants
- Variables
- func IsNotFound(err error) bool
- func NewPocketBasePasswordResetTokenRepository(app core.App, secret string) domain.PasswordResetTokenRepository
- func NewPocketBaseTokenBlacklistRepository(app core.App) domain.TokenBlacklistRepository
- type CommentCommandRepository
- type CommentQueryRepository
- type CommentRepository
- type GitHubAuthSessionRepository
- type PocketBaseGitHubCommitLinkRepository
- func (r *PocketBaseGitHubCommitLinkRepository) Create(_ context.Context, link *domain.GitHubCommitLink) error
- func (r *PocketBaseGitHubCommitLinkRepository) Delete(_ context.Context, id string) error
- func (r *PocketBaseGitHubCommitLinkRepository) GetByCommitSHA(_ context.Context, integrationID, commitSHA string) (*domain.GitHubCommitLink, error)
- func (r *PocketBaseGitHubCommitLinkRepository) GetByTaskID(_ context.Context, taskID string) ([]*domain.GitHubCommitLink, error)
- func (r *PocketBaseGitHubCommitLinkRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubCommitLink, error)
- type PocketBaseGitHubIntegrationRepository
- func (r *PocketBaseGitHubIntegrationRepository) Create(_ context.Context, integration *domain.GitHubIntegration) error
- func (r *PocketBaseGitHubIntegrationRepository) Delete(_ context.Context, id string) error
- func (r *PocketBaseGitHubIntegrationRepository) GetByID(_ context.Context, id string) (*domain.GitHubIntegration, error)
- func (r *PocketBaseGitHubIntegrationRepository) GetByProjectID(_ context.Context, projectID string) (*domain.GitHubIntegration, error)
- func (r *PocketBaseGitHubIntegrationRepository) GetByRepoFullName(_ context.Context, owner, name string) (*domain.GitHubIntegration, error)
- func (r *PocketBaseGitHubIntegrationRepository) List(_ context.Context, userID string) ([]*domain.GitHubIntegration, error)
- func (r *PocketBaseGitHubIntegrationRepository) Update(_ context.Context, integration *domain.GitHubIntegration) error
- type PocketBaseGitHubIssueMappingRepository
- func (r *PocketBaseGitHubIssueMappingRepository) Create(_ context.Context, mapping *domain.GitHubIssueMapping) error
- func (r *PocketBaseGitHubIssueMappingRepository) Delete(_ context.Context, id string) error
- func (r *PocketBaseGitHubIssueMappingRepository) GetByIssueNumber(_ context.Context, integrationID string, issueNumber int) (*domain.GitHubIssueMapping, error)
- func (r *PocketBaseGitHubIssueMappingRepository) GetByTaskID(_ context.Context, taskID string) (*domain.GitHubIssueMapping, error)
- func (r *PocketBaseGitHubIssueMappingRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubIssueMapping, error)
- func (r *PocketBaseGitHubIssueMappingRepository) Update(_ context.Context, mapping *domain.GitHubIssueMapping) error
- type PocketBaseGitHubOAuthStateRepository
- func (r *PocketBaseGitHubOAuthStateRepository) CleanupExpired(_ context.Context) error
- func (r *PocketBaseGitHubOAuthStateRepository) Create(_ context.Context, state *domain.GitHubOAuthState) error
- func (r *PocketBaseGitHubOAuthStateRepository) DeleteByState(_ context.Context, state string) error
- func (r *PocketBaseGitHubOAuthStateRepository) GetByState(_ context.Context, state string) (*domain.GitHubOAuthState, error)
- type PocketBaseGitHubPRMappingRepository
- func (r *PocketBaseGitHubPRMappingRepository) Create(_ context.Context, mapping *domain.GitHubPRMapping) error
- func (r *PocketBaseGitHubPRMappingRepository) Delete(_ context.Context, id string) error
- func (r *PocketBaseGitHubPRMappingRepository) GetByPRNumber(_ context.Context, integrationID string, prNumber int) (*domain.GitHubPRMapping, error)
- func (r *PocketBaseGitHubPRMappingRepository) GetByTaskID(_ context.Context, taskID string) (*domain.GitHubPRMapping, error)
- func (r *PocketBaseGitHubPRMappingRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubPRMapping, error)
- func (r *PocketBaseGitHubPRMappingRepository) Update(_ context.Context, mapping *domain.GitHubPRMapping) error
- type PocketBaseGitHubWebhookEventRepository
- func (r *PocketBaseGitHubWebhookEventRepository) CleanupOld(_ context.Context, olderThan time.Time) error
- func (r *PocketBaseGitHubWebhookEventRepository) Create(_ context.Context, event *domain.GitHubWebhookEvent) error
- func (r *PocketBaseGitHubWebhookEventRepository) GetByID(_ context.Context, id string) (*domain.GitHubWebhookEvent, error)
- func (r *PocketBaseGitHubWebhookEventRepository) ListUnprocessed(_ context.Context, limit int) ([]*domain.GitHubWebhookEvent, error)
- func (r *PocketBaseGitHubWebhookEventRepository) MarkError(_ context.Context, id string, errorMsg string) error
- func (r *PocketBaseGitHubWebhookEventRepository) MarkProcessed(_ context.Context, id string, processedAt time.Time) error
- type ProjectCommandRepository
- type ProjectQueryRepository
- type ProjectRepository
- type TaskCommandRepository
- type TaskFilters
- type TaskQueryRepository
- type TaskRepository
- type TaskUpdate
- type UserCommandRepository
- type UserQueryRepository
- type UserRepository
Constants ¶
const ( SortOrderAsc = "asc" SortOrderDesc = "desc" )
SortOrder constants for task sorting
const ( SortByCreated = "created" SortByUpdated = "updated" SortByTitle = "title" SortByStatus = "status" SortByPriority = "priority" SortByDueDate = "due_date" SortByPosition = "position" SortByProgress = "progress" )
Valid sort fields for tasks
Variables ¶
var ErrNotFound = errors.New("not found")
ErrNotFound is a sentinel error for not found conditions
Functions ¶
func IsNotFound ¶
IsNotFound checks if an error represents a "not found" condition. It uses errors.Is for proper error checking and falls back to legacy string comparison for compatibility with older error handling.
func NewPocketBasePasswordResetTokenRepository ¶
func NewPocketBasePasswordResetTokenRepository(app core.App, secret string) domain.PasswordResetTokenRepository
NewPocketBasePasswordResetTokenRepository creates a new PocketBase password reset token repository.
func NewPocketBaseTokenBlacklistRepository ¶
func NewPocketBaseTokenBlacklistRepository(app core.App) domain.TokenBlacklistRepository
NewPocketBaseTokenBlacklistRepository creates a new PocketBase token blacklist repository.
Types ¶
type CommentCommandRepository ¶
type CommentCommandRepository interface {
// Create creates a new comment
Create(ctx context.Context, comment *domain.Comment) error
// Update updates an existing comment
Update(ctx context.Context, comment *domain.Comment) error
// Delete deletes a comment by ID
Delete(ctx context.Context, id string) error
// BulkDelete deletes multiple comments
BulkDelete(ctx context.Context, ids []string) error
// DeleteByTask deletes all comments for a task
DeleteByTask(ctx context.Context, taskID string) error
// SoftDelete marks a comment as deleted without removing it
SoftDelete(ctx context.Context, id string) error
// Restore restores a soft-deleted comment
Restore(ctx context.Context, id string) error
}
CommentCommandRepository defines command operations for comments.
type CommentQueryRepository ¶
type CommentQueryRepository interface {
// GetByID retrieves a comment by its ID
GetByID(ctx context.Context, id string) (*domain.Comment, error)
// ListByTask retrieves comments for a specific task
ListByTask(ctx context.Context, taskID string, offset, limit int) ([]*domain.Comment, error)
// ListByAuthor retrieves comments by a specific author
ListByAuthor(ctx context.Context, authorID string, offset, limit int) ([]*domain.Comment, error)
// ListReplies retrieves replies to a specific comment
ListReplies(ctx context.Context, parentID string) ([]*domain.Comment, error)
// GetThread retrieves a comment thread (comment and its replies)
GetThread(ctx context.Context, rootCommentID string) ([]*domain.Comment, error)
// Count returns the total number of comments
Count(ctx context.Context) (int, error)
// CountByTask returns the number of comments for a task
CountByTask(ctx context.Context, taskID string) (int, error)
// CountByAuthor returns the number of comments by an author
CountByAuthor(ctx context.Context, authorID string) (int, error)
// ExistsByID checks if a comment exists by ID
ExistsByID(ctx context.Context, id string) (bool, error)
// Search searches comments by content
Search(ctx context.Context, query string, taskID string, offset, limit int) ([]*domain.Comment, error)
}
CommentQueryRepository defines query operations for comments.
type CommentRepository ¶
type CommentRepository interface {
CommentQueryRepository
CommentCommandRepository
}
CommentRepository defines the interface for comment data access operations.
func NewPocketBaseCommentRepository ¶
func NewPocketBaseCommentRepository(app core.App) CommentRepository
NewPocketBaseCommentRepository creates a new PocketBase comment repository.
type GitHubAuthSessionRepository ¶
type GitHubAuthSessionRepository interface {
// Create creates a new GitHub auth session
Create(ctx context.Context, session *domain.GitHubAuthSession) error
// GetByUserID retrieves a GitHub auth session by user ID
GetByUserID(ctx context.Context, userID string) (*domain.GitHubAuthSession, error)
// DeleteByUserID deletes a GitHub auth session by user ID
DeleteByUserID(ctx context.Context, userID string) error
// DeleteExpired deletes all expired GitHub auth sessions
DeleteExpired(ctx context.Context) error
}
GitHubAuthSessionRepository defines the interface for GitHub auth session data access.
func NewMemoryGitHubAuthSessionRepository ¶
func NewMemoryGitHubAuthSessionRepository() GitHubAuthSessionRepository
NewMemoryGitHubAuthSessionRepository creates a new in-memory GitHub auth session repository.
type PocketBaseGitHubCommitLinkRepository ¶
type PocketBaseGitHubCommitLinkRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubCommitLinkRepository implements GitHubCommitLinkRepository using PocketBase
func NewPocketBaseGitHubCommitLinkRepository ¶
func NewPocketBaseGitHubCommitLinkRepository(app core.App) *PocketBaseGitHubCommitLinkRepository
NewPocketBaseGitHubCommitLinkRepository creates a new GitHub commit link repository instance
func (*PocketBaseGitHubCommitLinkRepository) Create ¶
func (r *PocketBaseGitHubCommitLinkRepository) Create(_ context.Context, link *domain.GitHubCommitLink) error
Create creates a new GitHub commit link in PocketBase
func (*PocketBaseGitHubCommitLinkRepository) Delete ¶
func (r *PocketBaseGitHubCommitLinkRepository) Delete(_ context.Context, id string) error
Delete deletes a GitHub commit link from PocketBase
func (*PocketBaseGitHubCommitLinkRepository) GetByCommitSHA ¶
func (r *PocketBaseGitHubCommitLinkRepository) GetByCommitSHA(_ context.Context, integrationID, commitSHA string) (*domain.GitHubCommitLink, error)
GetByCommitSHA retrieves a GitHub commit link by commit SHA from PocketBase
func (*PocketBaseGitHubCommitLinkRepository) GetByTaskID ¶
func (r *PocketBaseGitHubCommitLinkRepository) GetByTaskID(_ context.Context, taskID string) ([]*domain.GitHubCommitLink, error)
GetByTaskID retrieves GitHub commit links by task ID from PocketBase
func (*PocketBaseGitHubCommitLinkRepository) ListByIntegration ¶
func (r *PocketBaseGitHubCommitLinkRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubCommitLink, error)
ListByIntegration retrieves GitHub commit links by integration ID from PocketBase
type PocketBaseGitHubIntegrationRepository ¶
type PocketBaseGitHubIntegrationRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubIntegrationRepository implements GitHubIntegrationRepository using PocketBase
func NewPocketBaseGitHubIntegrationRepository ¶
func NewPocketBaseGitHubIntegrationRepository(app core.App) *PocketBaseGitHubIntegrationRepository
NewPocketBaseGitHubIntegrationRepository creates a new GitHub integration repository instance
func (*PocketBaseGitHubIntegrationRepository) Create ¶
func (r *PocketBaseGitHubIntegrationRepository) Create(_ context.Context, integration *domain.GitHubIntegration) error
Create creates a new GitHub integration in PocketBase
func (*PocketBaseGitHubIntegrationRepository) Delete ¶
func (r *PocketBaseGitHubIntegrationRepository) Delete(_ context.Context, id string) error
Delete deletes a GitHub integration from PocketBase
func (*PocketBaseGitHubIntegrationRepository) GetByID ¶
func (r *PocketBaseGitHubIntegrationRepository) GetByID( _ context.Context, id string, ) (*domain.GitHubIntegration, error)
GetByID retrieves a GitHub integration by ID from PocketBase
func (*PocketBaseGitHubIntegrationRepository) GetByProjectID ¶
func (r *PocketBaseGitHubIntegrationRepository) GetByProjectID( _ context.Context, projectID string, ) (*domain.GitHubIntegration, error)
GetByProjectID retrieves a GitHub integration by project ID from PocketBase
func (*PocketBaseGitHubIntegrationRepository) GetByRepoFullName ¶
func (r *PocketBaseGitHubIntegrationRepository) GetByRepoFullName( _ context.Context, owner, name string, ) (*domain.GitHubIntegration, error)
GetByRepoFullName retrieves a GitHub integration by repository owner and name from PocketBase
func (*PocketBaseGitHubIntegrationRepository) List ¶
func (r *PocketBaseGitHubIntegrationRepository) List( _ context.Context, userID string, ) ([]*domain.GitHubIntegration, error)
List retrieves GitHub integrations for a user from PocketBase
func (*PocketBaseGitHubIntegrationRepository) Update ¶
func (r *PocketBaseGitHubIntegrationRepository) Update(_ context.Context, integration *domain.GitHubIntegration) error
Update updates a GitHub integration in PocketBase
type PocketBaseGitHubIssueMappingRepository ¶
type PocketBaseGitHubIssueMappingRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubIssueMappingRepository implements GitHubIssueMappingRepository using PocketBase
func NewPocketBaseGitHubIssueMappingRepository ¶
func NewPocketBaseGitHubIssueMappingRepository(app core.App) *PocketBaseGitHubIssueMappingRepository
NewPocketBaseGitHubIssueMappingRepository creates a new GitHub issue mapping repository instance
func (*PocketBaseGitHubIssueMappingRepository) Create ¶
func (r *PocketBaseGitHubIssueMappingRepository) Create(_ context.Context, mapping *domain.GitHubIssueMapping) error
Create creates a new GitHub issue mapping in PocketBase
func (*PocketBaseGitHubIssueMappingRepository) Delete ¶
func (r *PocketBaseGitHubIssueMappingRepository) Delete(_ context.Context, id string) error
Delete deletes a GitHub issue mapping from PocketBase
func (*PocketBaseGitHubIssueMappingRepository) GetByIssueNumber ¶
func (r *PocketBaseGitHubIssueMappingRepository) GetByIssueNumber(_ context.Context, integrationID string, issueNumber int) (*domain.GitHubIssueMapping, error)
GetByIssueNumber retrieves a GitHub issue mapping by issue number from PocketBase
func (*PocketBaseGitHubIssueMappingRepository) GetByTaskID ¶
func (r *PocketBaseGitHubIssueMappingRepository) GetByTaskID(_ context.Context, taskID string) (*domain.GitHubIssueMapping, error)
GetByTaskID retrieves a GitHub issue mapping by task ID from PocketBase
func (*PocketBaseGitHubIssueMappingRepository) ListByIntegration ¶
func (r *PocketBaseGitHubIssueMappingRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubIssueMapping, error)
ListByIntegration retrieves GitHub issue mappings by integration ID from PocketBase
func (*PocketBaseGitHubIssueMappingRepository) Update ¶
func (r *PocketBaseGitHubIssueMappingRepository) Update(_ context.Context, mapping *domain.GitHubIssueMapping) error
Update updates a GitHub issue mapping in PocketBase
type PocketBaseGitHubOAuthStateRepository ¶
type PocketBaseGitHubOAuthStateRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubOAuthStateRepository implements GitHubOAuthStateRepository using PocketBase
func NewPocketBaseGitHubOAuthStateRepository ¶
func NewPocketBaseGitHubOAuthStateRepository(app core.App) *PocketBaseGitHubOAuthStateRepository
NewPocketBaseGitHubOAuthStateRepository creates a new GitHub OAuth state repository instance
func (*PocketBaseGitHubOAuthStateRepository) CleanupExpired ¶
func (r *PocketBaseGitHubOAuthStateRepository) CleanupExpired(_ context.Context) error
CleanupExpired removes expired GitHub OAuth states from PocketBase
func (*PocketBaseGitHubOAuthStateRepository) Create ¶
func (r *PocketBaseGitHubOAuthStateRepository) Create(_ context.Context, state *domain.GitHubOAuthState) error
Create creates a new GitHub OAuth state in PocketBase
func (*PocketBaseGitHubOAuthStateRepository) DeleteByState ¶
func (r *PocketBaseGitHubOAuthStateRepository) DeleteByState(_ context.Context, state string) error
DeleteByState deletes a GitHub OAuth state by state value from PocketBase
func (*PocketBaseGitHubOAuthStateRepository) GetByState ¶
func (r *PocketBaseGitHubOAuthStateRepository) GetByState(_ context.Context, state string) (*domain.GitHubOAuthState, error)
GetByState retrieves a GitHub OAuth state by state value from PocketBase
type PocketBaseGitHubPRMappingRepository ¶
type PocketBaseGitHubPRMappingRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubPRMappingRepository implements GitHubPRMappingRepository using PocketBase
func NewPocketBaseGitHubPRMappingRepository ¶
func NewPocketBaseGitHubPRMappingRepository(app core.App) *PocketBaseGitHubPRMappingRepository
NewPocketBaseGitHubPRMappingRepository creates a new GitHub PR mapping repository instance
func (*PocketBaseGitHubPRMappingRepository) Create ¶
func (r *PocketBaseGitHubPRMappingRepository) Create(_ context.Context, mapping *domain.GitHubPRMapping) error
Create creates a new GitHub PR mapping in PocketBase
func (*PocketBaseGitHubPRMappingRepository) Delete ¶
func (r *PocketBaseGitHubPRMappingRepository) Delete(_ context.Context, id string) error
Delete deletes a GitHub PR mapping from PocketBase
func (*PocketBaseGitHubPRMappingRepository) GetByPRNumber ¶
func (r *PocketBaseGitHubPRMappingRepository) GetByPRNumber(_ context.Context, integrationID string, prNumber int) (*domain.GitHubPRMapping, error)
GetByPRNumber retrieves a GitHub PR mapping by PR number from PocketBase
func (*PocketBaseGitHubPRMappingRepository) GetByTaskID ¶
func (r *PocketBaseGitHubPRMappingRepository) GetByTaskID(_ context.Context, taskID string) (*domain.GitHubPRMapping, error)
GetByTaskID retrieves a GitHub PR mapping by task ID from PocketBase
func (*PocketBaseGitHubPRMappingRepository) ListByIntegration ¶
func (r *PocketBaseGitHubPRMappingRepository) ListByIntegration(_ context.Context, integrationID string) ([]*domain.GitHubPRMapping, error)
ListByIntegration retrieves GitHub PR mappings by integration ID from PocketBase
func (*PocketBaseGitHubPRMappingRepository) Update ¶
func (r *PocketBaseGitHubPRMappingRepository) Update(_ context.Context, mapping *domain.GitHubPRMapping) error
Update updates a GitHub PR mapping in PocketBase
type PocketBaseGitHubWebhookEventRepository ¶
type PocketBaseGitHubWebhookEventRepository struct {
// contains filtered or unexported fields
}
PocketBaseGitHubWebhookEventRepository implements GitHubWebhookEventRepository using PocketBase
func NewPocketBaseGitHubWebhookEventRepository ¶
func NewPocketBaseGitHubWebhookEventRepository(app core.App) *PocketBaseGitHubWebhookEventRepository
NewPocketBaseGitHubWebhookEventRepository creates a new GitHub webhook event repository instance
func (*PocketBaseGitHubWebhookEventRepository) CleanupOld ¶
func (r *PocketBaseGitHubWebhookEventRepository) CleanupOld(_ context.Context, olderThan time.Time) error
CleanupOld removes old GitHub webhook events from PocketBase
func (*PocketBaseGitHubWebhookEventRepository) Create ¶
func (r *PocketBaseGitHubWebhookEventRepository) Create(_ context.Context, event *domain.GitHubWebhookEvent) error
Create creates a new GitHub webhook event in PocketBase
func (*PocketBaseGitHubWebhookEventRepository) GetByID ¶
func (r *PocketBaseGitHubWebhookEventRepository) GetByID(_ context.Context, id string) (*domain.GitHubWebhookEvent, error)
GetByID retrieves a GitHub webhook event by ID from PocketBase
func (*PocketBaseGitHubWebhookEventRepository) ListUnprocessed ¶
func (r *PocketBaseGitHubWebhookEventRepository) ListUnprocessed(_ context.Context, limit int) ([]*domain.GitHubWebhookEvent, error)
ListUnprocessed retrieves unprocessed GitHub webhook events from PocketBase
func (*PocketBaseGitHubWebhookEventRepository) MarkError ¶
func (r *PocketBaseGitHubWebhookEventRepository) MarkError(_ context.Context, id string, errorMsg string) error
MarkError marks a GitHub webhook event with an error message in PocketBase
func (*PocketBaseGitHubWebhookEventRepository) MarkProcessed ¶
func (r *PocketBaseGitHubWebhookEventRepository) MarkProcessed(_ context.Context, id string, processedAt time.Time) error
MarkProcessed marks a GitHub webhook event as processed in PocketBase
type ProjectCommandRepository ¶
type ProjectCommandRepository interface {
// Create creates a new project.
Create(ctx context.Context, project *domain.Project) error
// Update updates an existing project.
Update(ctx context.Context, project *domain.Project) error
// Delete deletes a project by ID.
Delete(ctx context.Context, id string) error
}
ProjectCommandRepository defines write operations for projects. Following Interface Segregation Principle.
type ProjectQueryRepository ¶
type ProjectQueryRepository interface {
// GetByID retrieves a project by ID.
GetByID(ctx context.Context, id string) (*domain.Project, error)
// GetBySlug retrieves a project by slug.
GetBySlug(ctx context.Context, slug string) (*domain.Project, error)
// ListByOwner retrieves projects owned by a specific user.
ListByOwner(ctx context.Context, ownerID string, offset, limit int) ([]*domain.Project, error)
// ListByMember retrieves projects where a user is a member.
ListByMember(ctx context.Context, memberID string, offset, limit int) ([]*domain.Project, error)
// List retrieves projects with pagination.
List(ctx context.Context, offset, limit int) ([]*domain.Project, error)
// Count returns the total number of projects.
Count(ctx context.Context) (int, error)
// ExistsBySlug checks if a project exists with the given slug.
ExistsBySlug(ctx context.Context, slug string) (bool, error)
// GetMemberProjects retrieves all projects where user has access.
GetMemberProjects(ctx context.Context, userID string, offset, limit int) ([]*domain.Project, error)
}
ProjectQueryRepository defines read-only operations for project queries. Following Interface Segregation Principle.
type ProjectRepository ¶
type ProjectRepository interface {
// Create creates a new project.
Create(ctx context.Context, project *domain.Project) error
// GetByID retrieves a project by ID.
GetByID(ctx context.Context, id string) (*domain.Project, error)
// GetBySlug retrieves a project by slug.
GetBySlug(ctx context.Context, slug string) (*domain.Project, error)
// Update updates an existing project.
Update(ctx context.Context, project *domain.Project) error
// Delete deletes a project by ID.
Delete(ctx context.Context, id string) error
// ListByOwner retrieves projects owned by a specific user.
ListByOwner(ctx context.Context, ownerID string, offset, limit int) ([]*domain.Project, error)
// ListByMember retrieves projects where a user is a member.
ListByMember(ctx context.Context, memberID string, offset, limit int) ([]*domain.Project, error)
// List retrieves projects with pagination.
List(ctx context.Context, offset, limit int) ([]*domain.Project, error)
// Count returns the total number of projects.
Count(ctx context.Context) (int, error)
// ExistsBySlug checks if a project exists with the given slug.
ExistsBySlug(ctx context.Context, slug string) (bool, error)
// GetMemberProjects retrieves all projects where user has access.
GetMemberProjects(ctx context.Context, userID string, offset, limit int) ([]*domain.Project, error)
}
ProjectRepository defines the interface for project data operations. Following Interface Segregation Principle.
func NewPocketBaseProjectRepository ¶
func NewPocketBaseProjectRepository(app core.App) ProjectRepository
NewPocketBaseProjectRepository creates a new PocketBase project repository.
type TaskCommandRepository ¶
type TaskCommandRepository interface {
// Create creates a new task
Create(ctx context.Context, task *domain.Task) error
// Update updates an existing task
Update(ctx context.Context, task *domain.Task) error
// Delete deletes a task by ID
Delete(ctx context.Context, id string) error
// Move moves a task to a new status and position
Move(ctx context.Context, taskID string, newStatus domain.TaskStatus, position int) error
// BulkUpdate updates multiple tasks
BulkUpdate(ctx context.Context, tasks []*domain.Task) error
// BulkDelete deletes multiple tasks
BulkDelete(ctx context.Context, ids []string) error
// BulkUpdateStatus updates multiple tasks with the same status
BulkUpdateStatus(ctx context.Context, taskIDs []string, newStatus domain.TaskStatus) error
// ArchiveTask archives a task instead of deleting it
ArchiveTask(ctx context.Context, id string) error
// UnarchiveTask unarchives a task
UnarchiveTask(ctx context.Context, id string) error
}
TaskCommandRepository defines command operations for tasks.
type TaskFilters ¶
type TaskFilters struct {
Status []domain.TaskStatus `json:"status,omitempty"` // 24 bytes
Priority []domain.TaskPriority `json:"priority,omitempty"` // 24 bytes
Tags []string `json:"tags,omitempty"` // 24 bytes
Search string `json:"search,omitempty"` // 16 bytes
SortBy string `json:"sort_by,omitempty"` // 16 bytes
SortOrder string `json:"sort_order,omitempty"` // 16 bytes
DueBefore *time.Time `json:"due_before,omitempty"` // 8 bytes
DueAfter *time.Time `json:"due_after,omitempty"` // 8 bytes
AssigneeID *string `json:"assignee_id,omitempty"` // 8 bytes
ReporterID *string `json:"reporter_id,omitempty"` // 8 bytes
ParentID *string `json:"parent_id,omitempty"` // 8 bytes
Archived *bool `json:"archived,omitempty"` // 8 bytes
HasParent *bool `json:"has_parent,omitempty"` // 8 bytes
Limit int `json:"limit,omitempty"` // 8 bytes
Offset int `json:"offset,omitempty"` // 8 bytes
}
TaskFilters provides advanced filtering options for task queries
type TaskQueryRepository ¶
type TaskQueryRepository interface {
// GetByID retrieves a task by its ID
GetByID(ctx context.Context, id string) (*domain.Task, error)
// GetByProject retrieves tasks for a specific project with advanced filtering
GetByProject(ctx context.Context, projectID string, filters TaskFilters) ([]*domain.Task, error)
// ListByProject retrieves tasks for a specific project (legacy method)
ListByProject(ctx context.Context, projectID string, offset, limit int) ([]*domain.Task, error)
// ListByAssignee retrieves tasks assigned to a specific user
ListByAssignee(ctx context.Context, assigneeID string, offset, limit int) ([]*domain.Task, error)
// ListByStatus retrieves tasks by status
ListByStatus(ctx context.Context, status domain.TaskStatus, offset, limit int) ([]*domain.Task, error)
// ListByCreator retrieves tasks created by a specific user
ListByCreator(ctx context.Context, creatorID string, offset, limit int) ([]*domain.Task, error)
// Search searches tasks by title, description or content
Search(ctx context.Context, query string, projectID string, offset, limit int) ([]*domain.Task, error)
// GetSubtasks retrieves subtasks for a parent task
GetSubtasks(ctx context.Context, parentID string) ([]*domain.Task, error)
// GetDependencies retrieves dependency tasks for a task
GetDependencies(ctx context.Context, taskID string) ([]*domain.Task, error)
// GetTasksByFilter retrieves tasks using advanced filters
GetTasksByFilter(ctx context.Context, filters TaskFilters) ([]*domain.Task, error)
// Count returns the total number of tasks matching criteria
Count(ctx context.Context) (int, error)
// CountByProject returns the number of tasks in a project
CountByProject(ctx context.Context, projectID string) (int, error)
// CountByAssignee returns the number of tasks assigned to a user
CountByAssignee(ctx context.Context, assigneeID string) (int, error)
// CountByStatus returns the number of tasks with a specific status
CountByStatus(ctx context.Context, status domain.TaskStatus) (int, error)
// ExistsByID checks if a task exists by ID
ExistsByID(ctx context.Context, id string) (bool, error)
}
TaskQueryRepository defines query operations for tasks.
type TaskRepository ¶
type TaskRepository interface {
TaskQueryRepository
TaskCommandRepository
}
TaskRepository defines the interface for task data access operations.
func NewPocketBaseTaskRepository ¶
func NewPocketBaseTaskRepository(app core.App) TaskRepository
NewPocketBaseTaskRepository creates a new PocketBase task repository.
type TaskUpdate ¶
type TaskUpdate struct {
Fields map[string]interface{} `json:"fields"`
TaskID string `json:"task_id"`
}
TaskUpdate represents a single task update operation for bulk updates
type UserCommandRepository ¶
type UserCommandRepository interface {
// Create creates a new user.
Create(ctx context.Context, user *domain.User) error
// Update updates an existing user.
Update(ctx context.Context, user *domain.User) error
// Delete deletes a user by ID.
Delete(ctx context.Context, id string) error
}
UserCommandRepository defines write operations for users. Following Interface Segregation Principle.
type UserQueryRepository ¶
type UserQueryRepository interface {
// GetByID retrieves a user by ID.
GetByID(ctx context.Context, id string) (*domain.User, error)
// GetByEmail retrieves a user by email address.
GetByEmail(ctx context.Context, email string) (*domain.User, error)
// GetByUsername retrieves a user by username.
GetByUsername(ctx context.Context, username string) (*domain.User, error)
// List retrieves users with pagination.
List(ctx context.Context, offset, limit int) ([]*domain.User, error)
// Count returns the total number of users.
Count(ctx context.Context) (int, error)
// ExistsByEmail checks if a user exists with the given email.
ExistsByEmail(ctx context.Context, email string) (bool, error)
// ExistsByUsername checks if a user exists with the given username.
ExistsByUsername(ctx context.Context, username string) (bool, error)
}
UserQueryRepository defines read-only operations for user queries. Following Interface Segregation Principle.
type UserRepository ¶
type UserRepository interface {
// Create creates a new user.
Create(ctx context.Context, user *domain.User) error
// GetByID retrieves a user by ID.
GetByID(ctx context.Context, id string) (*domain.User, error)
// GetByEmail retrieves a user by email address.
GetByEmail(ctx context.Context, email string) (*domain.User, error)
// GetByUsername retrieves a user by username.
GetByUsername(ctx context.Context, username string) (*domain.User, error)
// Update updates an existing user.
Update(ctx context.Context, user *domain.User) error
// Delete deletes a user by ID.
Delete(ctx context.Context, id string) error
// List retrieves users with pagination.
List(ctx context.Context, offset, limit int) ([]*domain.User, error)
// Count returns the total number of users.
Count(ctx context.Context) (int, error)
// ExistsByEmail checks if a user exists with the given email.
ExistsByEmail(ctx context.Context, email string) (bool, error)
// ExistsByUsername checks if a user exists with the given username.
ExistsByUsername(ctx context.Context, username string) (bool, error)
}
UserRepository defines the interface for user data operations. Following Interface Segregation Principle.
func NewPocketBaseUserRepository ¶
func NewPocketBaseUserRepository(app core.App) UserRepository
NewPocketBaseUserRepository creates a new PocketBase user repository.
Source Files
¶
- comment_repository.go
- constants.go
- errorutil.go
- github_auth_session_repository.go
- memory_github_auth_session_repository.go
- pocketbase_comment_repository.go
- pocketbase_github_repository.go
- pocketbase_password_reset_token_repository.go
- pocketbase_project_repository.go
- pocketbase_task_repository.go
- pocketbase_token_blacklist_repository.go
- pocketbase_user_repository.go
- project_repository.go
- task_repository.go
- user_repository.go