Documentation
¶
Index ¶
- Variables
- func NewClient(conf *config.CacheDatabaseConfig) (redis.UniversalClient, error)
- type CacheBackend
- type CachedAssignmentRepository
- func (r *CachedAssignmentRepository) Create(ctx context.Context, assignment *model.Assignment) error
- func (r *CachedAssignmentRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedAssignmentRepository) Get(ctx context.Context, id model.ID) (*model.Assignment, error)
- func (r *CachedAssignmentRepository) GetByResource(ctx context.Context, resourceID model.ID, offset, limit int) ([]*model.Assignment, error)
- func (r *CachedAssignmentRepository) GetByUser(ctx context.Context, userID model.ID, offset, limit int) ([]*model.Assignment, error)
- type CachedAttachmentRepository
- func (r *CachedAttachmentRepository) Create(ctx context.Context, belongsTo model.ID, attachment *model.Attachment) error
- func (r *CachedAttachmentRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedAttachmentRepository) Get(ctx context.Context, id model.ID) (*model.Attachment, error)
- func (r *CachedAttachmentRepository) GetAllBelongsTo(ctx context.Context, belongsTo model.ID, offset, limit int) ([]*model.Attachment, error)
- func (r *CachedAttachmentRepository) Update(ctx context.Context, id model.ID, name string) (*model.Attachment, error)
- type CachedCommentRepository
- func (r *CachedCommentRepository) Create(ctx context.Context, belongsTo model.ID, comment *model.Comment) error
- func (r *CachedCommentRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedCommentRepository) Get(ctx context.Context, id model.ID) (*model.Comment, error)
- func (r *CachedCommentRepository) GetAllBelongsTo(ctx context.Context, belongsTo model.ID, offset, limit int) ([]*model.Comment, error)
- func (r *CachedCommentRepository) Update(ctx context.Context, id model.ID, content string) (*model.Comment, error)
- type CachedDocumentRepository
- func (r *CachedDocumentRepository) Create(ctx context.Context, belongsTo model.ID, document *model.Document) error
- func (r *CachedDocumentRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedDocumentRepository) Get(ctx context.Context, id model.ID) (*model.Document, error)
- func (r *CachedDocumentRepository) GetAllBelongsTo(ctx context.Context, belongsTo model.ID, offset, limit int) ([]*model.Document, error)
- func (r *CachedDocumentRepository) GetByCreator(ctx context.Context, createdBy model.ID, offset, limit int) ([]*model.Document, error)
- func (r *CachedDocumentRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Document, error)
- type CachedIssueRepository
- func (r *CachedIssueRepository) AddRelation(ctx context.Context, relation *model.IssueRelation) error
- func (r *CachedIssueRepository) AddWatcher(ctx context.Context, issue model.ID, user model.ID) error
- func (r *CachedIssueRepository) Create(ctx context.Context, project model.ID, issue *model.Issue) error
- func (r *CachedIssueRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedIssueRepository) Get(ctx context.Context, id model.ID) (*model.Issue, error)
- func (r *CachedIssueRepository) GetAllForIssue(ctx context.Context, issueID model.ID, offset, limit int) ([]*model.Issue, error)
- func (r *CachedIssueRepository) GetAllForProject(ctx context.Context, projectID model.ID, offset, limit int) ([]*model.Issue, error)
- func (r *CachedIssueRepository) GetRelations(ctx context.Context, issue model.ID) ([]*model.IssueRelation, error)
- func (r *CachedIssueRepository) GetWatchers(ctx context.Context, issue model.ID) ([]*model.User, error)
- func (r *CachedIssueRepository) RemoveRelation(ctx context.Context, source, target model.ID, kind model.IssueRelationKind) error
- func (r *CachedIssueRepository) RemoveWatcher(ctx context.Context, issue model.ID, user model.ID) error
- func (r *CachedIssueRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Issue, error)
- type CachedLabelRepository
- func (r *CachedLabelRepository) AttachTo(ctx context.Context, labelID, attachTo model.ID) error
- func (r *CachedLabelRepository) Create(ctx context.Context, label *model.Label) error
- func (r *CachedLabelRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedLabelRepository) DetachFrom(ctx context.Context, labelID, detachFrom model.ID) error
- func (r *CachedLabelRepository) Get(ctx context.Context, id model.ID) (*model.Label, error)
- func (r *CachedLabelRepository) GetAll(ctx context.Context, offset, limit int) ([]*model.Label, error)
- func (r *CachedLabelRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Label, error)
- type CachedNamespaceRepository
- func (r *CachedNamespaceRepository) Create(ctx context.Context, orgID model.ID, namespace *model.Namespace) error
- func (r *CachedNamespaceRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedNamespaceRepository) Get(ctx context.Context, id model.ID) (*model.Namespace, error)
- func (r *CachedNamespaceRepository) GetAll(ctx context.Context, orgID model.ID, offset, limit int) ([]*model.Namespace, error)
- func (r *CachedNamespaceRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Namespace, error)
- type CachedNotificationRepository
- func (r *CachedNotificationRepository) Create(ctx context.Context, notification *model.Notification) error
- func (r *CachedNotificationRepository) Delete(ctx context.Context, id, recipient model.ID) error
- func (r *CachedNotificationRepository) Get(ctx context.Context, id, recipient model.ID) (*model.Notification, error)
- func (r *CachedNotificationRepository) GetAllByRecipient(ctx context.Context, recipient model.ID, offset, limit int) ([]*model.Notification, error)
- func (r *CachedNotificationRepository) Update(ctx context.Context, id, recipient model.ID, read bool) (*model.Notification, error)
- type CachedOrganizationRepository
- func (r *CachedOrganizationRepository) AddMember(ctx context.Context, orgID, memberID model.ID) error
- func (r *CachedOrganizationRepository) Create(ctx context.Context, owner model.ID, organization *model.Organization) error
- func (r *CachedOrganizationRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedOrganizationRepository) Get(ctx context.Context, id model.ID) (*model.Organization, error)
- func (r *CachedOrganizationRepository) GetAll(ctx context.Context, offset, limit int) ([]*model.Organization, error)
- func (r *CachedOrganizationRepository) RemoveMember(ctx context.Context, orgID, memberID model.ID) error
- func (r *CachedOrganizationRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Organization, error)
- type CachedPermissionRepository
- func (c *CachedPermissionRepository) Create(ctx context.Context, perm *model.Permission) error
- func (c *CachedPermissionRepository) Delete(ctx context.Context, id model.ID) error
- func (c *CachedPermissionRepository) Get(ctx context.Context, id model.ID) (*model.Permission, error)
- func (c *CachedPermissionRepository) GetBySubject(ctx context.Context, id model.ID) ([]*model.Permission, error)
- func (c *CachedPermissionRepository) GetBySubjectAndTarget(ctx context.Context, source, target model.ID) ([]*model.Permission, error)
- func (c *CachedPermissionRepository) GetByTarget(ctx context.Context, id model.ID) ([]*model.Permission, error)
- func (c *CachedPermissionRepository) HasAnyRelation(ctx context.Context, source, target model.ID) (bool, error)
- func (c *CachedPermissionRepository) HasPermission(ctx context.Context, subject, target model.ID, kinds ...model.PermissionKind) (bool, error)
- func (c *CachedPermissionRepository) HasSystemRole(ctx context.Context, source model.ID, roles ...model.SystemRole) (bool, error)
- func (c *CachedPermissionRepository) Update(ctx context.Context, id model.ID, kind model.PermissionKind) (*model.Permission, error)
- type CachedProjectRepository
- func (r *CachedProjectRepository) Create(ctx context.Context, namespaceID model.ID, project *model.Project) error
- func (r *CachedProjectRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedProjectRepository) Get(ctx context.Context, id model.ID) (*model.Project, error)
- func (r *CachedProjectRepository) GetAll(ctx context.Context, namespaceID model.ID, offset, limit int) ([]*model.Project, error)
- func (r *CachedProjectRepository) GetByKey(ctx context.Context, key string) (*model.Project, error)
- func (r *CachedProjectRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Project, error)
- type CachedRoleRepository
- func (r *CachedRoleRepository) AddMember(ctx context.Context, roleID, memberID, belongsToID model.ID) error
- func (r *CachedRoleRepository) Create(ctx context.Context, createdBy, belongsTo model.ID, role *model.Role) error
- func (r *CachedRoleRepository) Delete(ctx context.Context, id, belongsTo model.ID) error
- func (r *CachedRoleRepository) Get(ctx context.Context, id, belongsTo model.ID) (*model.Role, error)
- func (r *CachedRoleRepository) GetAllBelongsTo(ctx context.Context, belongsTo model.ID, offset, limit int) ([]*model.Role, error)
- func (r *CachedRoleRepository) RemoveMember(ctx context.Context, roleID, memberID, belongsToID model.ID) error
- func (r *CachedRoleRepository) Update(ctx context.Context, id, belongsTo model.ID, patch map[string]any) (*model.Role, error)
- type CachedTodoRepository
- func (r *CachedTodoRepository) Create(ctx context.Context, todo *model.Todo) error
- func (r *CachedTodoRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedTodoRepository) Get(ctx context.Context, id model.ID) (*model.Todo, error)
- func (r *CachedTodoRepository) GetByOwner(ctx context.Context, ownerID model.ID, offset, limit int, completed *bool) ([]*model.Todo, error)
- func (r *CachedTodoRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.Todo, error)
- type CachedUserRepository
- func (r *CachedUserRepository) Create(ctx context.Context, user *model.User) error
- func (r *CachedUserRepository) Delete(ctx context.Context, id model.ID) error
- func (r *CachedUserRepository) Get(ctx context.Context, id model.ID) (*model.User, error)
- func (r *CachedUserRepository) GetAll(ctx context.Context, offset, limit int) ([]*model.User, error)
- func (r *CachedUserRepository) GetByEmail(ctx context.Context, email string) (*model.User, error)
- func (r *CachedUserRepository) Update(ctx context.Context, id model.ID, patch map[string]any) (*model.User, error)
- type Database
- type DatabaseOption
- type RepositoryOption
Constants ¶
This section is empty.
Variables ¶
var ErrUnexpectedCachedResource = errors.New("unexpected cached resource") // received cache resource was not expected
Functions ¶
func NewClient ¶
func NewClient(conf *config.CacheDatabaseConfig) (redis.UniversalClient, error)
NewClient creates a new Redis client.
Types ¶
type CacheBackend ¶
type CacheBackend interface { Set(item *cache.Item) error Get(ctx context.Context, key string, dst any) error Delete(ctx context.Context, key string) error }
CacheBackend represents a cache backend.
type CachedAssignmentRepository ¶
type CachedAssignmentRepository struct {
// contains filtered or unexported fields
}
CachedAssignmentRepository implements caching on the repository.AssignmentRepository.
func NewCachedAssignmentRepository ¶
func NewCachedAssignmentRepository(repo repository.AssignmentRepository, opts ...RepositoryOption) (*CachedAssignmentRepository, error)
NewCachedAssignmentRepository returns a new CachedAssignmentRepository.
func (*CachedAssignmentRepository) Create ¶
func (r *CachedAssignmentRepository) Create(ctx context.Context, assignment *model.Assignment) error
func (*CachedAssignmentRepository) Get ¶
func (r *CachedAssignmentRepository) Get(ctx context.Context, id model.ID) (*model.Assignment, error)
func (*CachedAssignmentRepository) GetByResource ¶
func (r *CachedAssignmentRepository) GetByResource(ctx context.Context, resourceID model.ID, offset, limit int) ([]*model.Assignment, error)
type CachedAttachmentRepository ¶
type CachedAttachmentRepository struct {
// contains filtered or unexported fields
}
CachedAttachmentRepository implements caching on the repository.AttachmentRepository.
func NewCachedAttachmentRepository ¶
func NewCachedAttachmentRepository(repo repository.AttachmentRepository, opts ...RepositoryOption) (*CachedAttachmentRepository, error)
NewCachedAttachmentRepository returns a new CachedAttachmentRepository.
func (*CachedAttachmentRepository) Create ¶
func (r *CachedAttachmentRepository) Create(ctx context.Context, belongsTo model.ID, attachment *model.Attachment) error
func (*CachedAttachmentRepository) Get ¶
func (r *CachedAttachmentRepository) Get(ctx context.Context, id model.ID) (*model.Attachment, error)
func (*CachedAttachmentRepository) GetAllBelongsTo ¶
func (r *CachedAttachmentRepository) GetAllBelongsTo(ctx context.Context, belongsTo model.ID, offset, limit int) ([]*model.Attachment, error)
type CachedCommentRepository ¶
type CachedCommentRepository struct {
// contains filtered or unexported fields
}
CachedCommentRepository implements caching on the repository.CommentRepository.
func NewCachedCommentRepository ¶
func NewCachedCommentRepository(repo repository.CommentRepository, opts ...RepositoryOption) (*CachedCommentRepository, error)
NewCachedCommentRepository returns a new CachedCommentRepository.
func (*CachedCommentRepository) GetAllBelongsTo ¶
type CachedDocumentRepository ¶
type CachedDocumentRepository struct {
// contains filtered or unexported fields
}
CachedDocumentRepository implements caching on the repository.DocumentRepository.
func NewCachedDocumentRepository ¶
func NewCachedDocumentRepository(repo repository.DocumentRepository, opts ...RepositoryOption) (*CachedDocumentRepository, error)
NewCachedDocumentRepository returns a new CachedDocumentRepository.
func (*CachedDocumentRepository) GetAllBelongsTo ¶
func (*CachedDocumentRepository) GetByCreator ¶
type CachedIssueRepository ¶
type CachedIssueRepository struct {
// contains filtered or unexported fields
}
CachedIssueRepository implements caching on the repository.IssueRepository.
func NewCachedIssueRepository ¶
func NewCachedIssueRepository(repo repository.IssueRepository, opts ...RepositoryOption) (*CachedIssueRepository, error)
NewCachedIssueRepository returns a new CachedIssueRepository.
func (*CachedIssueRepository) AddRelation ¶
func (r *CachedIssueRepository) AddRelation(ctx context.Context, relation *model.IssueRelation) error
func (*CachedIssueRepository) AddWatcher ¶
func (*CachedIssueRepository) GetAllForIssue ¶
func (*CachedIssueRepository) GetAllForProject ¶
func (*CachedIssueRepository) GetRelations ¶
func (r *CachedIssueRepository) GetRelations(ctx context.Context, issue model.ID) ([]*model.IssueRelation, error)
func (*CachedIssueRepository) GetWatchers ¶
func (*CachedIssueRepository) RemoveRelation ¶
func (r *CachedIssueRepository) RemoveRelation(ctx context.Context, source, target model.ID, kind model.IssueRelationKind) error
func (*CachedIssueRepository) RemoveWatcher ¶
type CachedLabelRepository ¶
type CachedLabelRepository struct {
// contains filtered or unexported fields
}
CachedLabelRepository implements caching on the repository.LabelRepository.
func NewCachedLabelRepository ¶
func NewCachedLabelRepository(repo repository.LabelRepository, opts ...RepositoryOption) (*CachedLabelRepository, error)
NewCachedLabelRepository returns a new CachedLabelRepository.
func (*CachedLabelRepository) DetachFrom ¶
type CachedNamespaceRepository ¶
type CachedNamespaceRepository struct {
// contains filtered or unexported fields
}
CachedNamespaceRepository implements caching on the repository.NamespaceRepository.
func NewCachedNamespaceRepository ¶
func NewCachedNamespaceRepository(repo repository.NamespaceRepository, opts ...RepositoryOption) (*CachedNamespaceRepository, error)
NewCachedNamespaceRepository returns a new CachedNamespaceRepository.
type CachedNotificationRepository ¶
type CachedNotificationRepository struct {
// contains filtered or unexported fields
}
CachedNotificationRepository implements caching on the repository.NotificationRepository.
func NewCachedNotificationRepository ¶
func NewCachedNotificationRepository(repo repository.NotificationRepository, opts ...RepositoryOption) (*CachedNotificationRepository, error)
NewCachedNotificationRepository returns a new CachedNotificationRepository.
func (*CachedNotificationRepository) Create ¶
func (r *CachedNotificationRepository) Create(ctx context.Context, notification *model.Notification) error
func (*CachedNotificationRepository) Get ¶
func (r *CachedNotificationRepository) Get(ctx context.Context, id, recipient model.ID) (*model.Notification, error)
func (*CachedNotificationRepository) GetAllByRecipient ¶
func (r *CachedNotificationRepository) GetAllByRecipient(ctx context.Context, recipient model.ID, offset, limit int) ([]*model.Notification, error)
type CachedOrganizationRepository ¶
type CachedOrganizationRepository struct {
// contains filtered or unexported fields
}
CachedOrganizationRepository implements caching on the repository.OrganizationRepository.
func NewCachedOrganizationRepository ¶
func NewCachedOrganizationRepository(repo repository.OrganizationRepository, opts ...RepositoryOption) (*CachedOrganizationRepository, error)
NewCachedOrganizationRepository returns a new CachedOrganizationRepository.
func (*CachedOrganizationRepository) Create ¶
func (r *CachedOrganizationRepository) Create(ctx context.Context, owner model.ID, organization *model.Organization) error
func (*CachedOrganizationRepository) Get ¶
func (r *CachedOrganizationRepository) Get(ctx context.Context, id model.ID) (*model.Organization, error)
func (*CachedOrganizationRepository) GetAll ¶
func (r *CachedOrganizationRepository) GetAll(ctx context.Context, offset, limit int) ([]*model.Organization, error)
func (*CachedOrganizationRepository) RemoveMember ¶
type CachedPermissionRepository ¶
type CachedPermissionRepository struct {
// contains filtered or unexported fields
}
CachedPermissionRepository implements cache clearing on resources that are related dependent on permission changes. This repository does not cache any data to prevent stale permission data. This repository mostly acts as a proxy to the permission repository and clears the cache on any changes.
Adding permission caching could be a future improvement, but that's a double-edged sword. It would be a performance improvement, but it would also mean that stale data could be cached.
func NewCachedPermissionRepository ¶
func NewCachedPermissionRepository(repo repository.PermissionRepository, opts ...RepositoryOption) (*CachedPermissionRepository, error)
NewCachedPermissionRepository returns a new CachedPermissionRepository.
func (*CachedPermissionRepository) Create ¶
func (c *CachedPermissionRepository) Create(ctx context.Context, perm *model.Permission) error
func (*CachedPermissionRepository) Get ¶
func (c *CachedPermissionRepository) Get(ctx context.Context, id model.ID) (*model.Permission, error)
func (*CachedPermissionRepository) GetBySubject ¶
func (c *CachedPermissionRepository) GetBySubject(ctx context.Context, id model.ID) ([]*model.Permission, error)
func (*CachedPermissionRepository) GetBySubjectAndTarget ¶
func (c *CachedPermissionRepository) GetBySubjectAndTarget(ctx context.Context, source, target model.ID) ([]*model.Permission, error)
func (*CachedPermissionRepository) GetByTarget ¶
func (c *CachedPermissionRepository) GetByTarget(ctx context.Context, id model.ID) ([]*model.Permission, error)
func (*CachedPermissionRepository) HasAnyRelation ¶
func (*CachedPermissionRepository) HasPermission ¶
func (c *CachedPermissionRepository) HasPermission(ctx context.Context, subject, target model.ID, kinds ...model.PermissionKind) (bool, error)
func (*CachedPermissionRepository) HasSystemRole ¶
func (c *CachedPermissionRepository) HasSystemRole(ctx context.Context, source model.ID, roles ...model.SystemRole) (bool, error)
func (*CachedPermissionRepository) Update ¶
func (c *CachedPermissionRepository) Update(ctx context.Context, id model.ID, kind model.PermissionKind) (*model.Permission, error)
type CachedProjectRepository ¶
type CachedProjectRepository struct {
// contains filtered or unexported fields
}
CachedProjectRepository implements caching on the repository.ProjectRepository.
func NewCachedProjectRepository ¶
func NewCachedProjectRepository(repo repository.ProjectRepository, opts ...RepositoryOption) (*CachedProjectRepository, error)
NewCachedProjectRepository returns a new CachedProjectRepository.
type CachedRoleRepository ¶
type CachedRoleRepository struct {
// contains filtered or unexported fields
}
CachedRoleRepository implements caching on the repository.RoleRepository.
func NewCachedRoleRepository ¶
func NewCachedRoleRepository(repo repository.RoleRepository, opts ...RepositoryOption) (*CachedRoleRepository, error)
NewCachedRoleRepository returns a new CachedRoleRepository.
func (*CachedRoleRepository) GetAllBelongsTo ¶
func (*CachedRoleRepository) RemoveMember ¶
type CachedTodoRepository ¶
type CachedTodoRepository struct {
// contains filtered or unexported fields
}
CachedTodoRepository is implements caching on the repository.TodoRepository.
func NewCachedTodoRepository ¶
func NewCachedTodoRepository(repo repository.TodoRepository, opts ...RepositoryOption) (*CachedTodoRepository, error)
NewCachedTodoRepository returns a new CachedTodoRepository.
func (*CachedTodoRepository) GetByOwner ¶
type CachedUserRepository ¶
type CachedUserRepository struct {
// contains filtered or unexported fields
}
CachedUserRepository implements caching on the repository.UserRepository.
func NewCachedUserRepository ¶
func NewCachedUserRepository(repo repository.UserRepository, opts ...RepositoryOption) (*CachedUserRepository, error)
NewCachedUserRepository returns a new CachedUserRepository.
func (*CachedUserRepository) GetByEmail ¶
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database represents a Redis database, wrapping a redis connection.
func NewDatabase ¶
func NewDatabase(opts ...DatabaseOption) (*Database, error)
NewDatabase creates a new Redis database.
type DatabaseOption ¶
DatabaseOption configures a Redis database.
func WithClient ¶
func WithClient(client redis.UniversalClient) DatabaseOption
WithClient sets the client for a Redis database.
func WithDatabaseLogger ¶
func WithDatabaseLogger(logger log.Logger) DatabaseOption
WithDatabaseLogger sets the logger for a Neo4j database.
func WithDatabaseTracer ¶
func WithDatabaseTracer(tracer tracing.Tracer) DatabaseOption
WithDatabaseTracer sets the tracer for a Neo4j database.
type RepositoryOption ¶
type RepositoryOption func(*baseRepository) error
RepositoryOption configures a baseRepository for a Neo4j baseRepository.
func WithDatabase ¶
func WithDatabase(db *Database) RepositoryOption
WithDatabase sets the baseRepository for a baseRepository.
func WithRepositoryLogger ¶
func WithRepositoryLogger(logger log.Logger) RepositoryOption
WithRepositoryLogger sets the logger for a baseRepository.
func WithRepositoryTracer ¶
func WithRepositoryTracer(tracer tracing.Tracer) RepositoryOption
WithRepositoryTracer sets the tracer for a baseRepository.