Documentation
¶
Index ¶
- type Store
- func (s *Store) AcceptOwnershipTransfer(ctx context.Context, id string, user auth.Principal) (repo.OwnershipTransfer, error)
- func (s *Store) AppendDocumentEvent(ctx context.Context, documentID, kind string, data json.RawMessage, ...) error
- func (s *Store) ClaimCommentNotification(ctx context.Context) (*repo.CommentNotification, error)
- func (s *Store) ClaimDocumentAccessNotification(ctx context.Context) (*repo.DocumentAccessNotification, error)
- func (s *Store) ClaimDocumentAccessRequestNotification(ctx context.Context) (*repo.DocumentAccessRequestNotification, error)
- func (s *Store) Close()
- func (s *Store) CreateCLICredential(ctx context.Context, userID, name, tokenHash string) (string, error)
- func (s *Store) CreateComment(ctx context.Context, documentID, versionID, body string, anchor repo.Anchor, ...) (repo.Comment, error)
- func (s *Store) CreateCommentReply(ctx context.Context, documentID, parentCommentID, body string, ...) (repo.Comment, error)
- func (s *Store) CreateDocument(ctx context.Context, owner auth.Principal, title string, html []byte) (repo.Document, repo.Version, error)
- func (s *Store) CreateFolder(ctx context.Context, owner auth.Principal, title, parent string) (repo.Folder, error)
- func (s *Store) CreateGrant(ctx context.Context, resourceType, resourceID string, principal auth.Principal, ...) (repo.Grant, error)
- func (s *Store) CreateOwnershipTransfer(ctx context.Context, saID string, from auth.Principal, toEmail string) (repo.OwnershipTransfer, error)
- func (s *Store) CreateServiceAccount(ctx context.Context, owner auth.Principal, name string) (repo.ServiceAccount, error)
- func (s *Store) CreateServiceAccountKey(ctx context.Context, saID, name, tokenHash string) (string, error)
- func (s *Store) CreateVersion(ctx context.Context, documentID, baseVersionID, changeSummary string, ...) (repo.Version, error)
- func (s *Store) CurrentDocumentKVRevision(ctx context.Context, documentID string) (int64, error)
- func (s *Store) DeclineOwnershipTransfer(ctx context.Context, id string, user auth.Principal) error
- func (s *Store) DeleteComment(ctx context.Context, id string) error
- func (s *Store) DeleteCommentReaction(ctx context.Context, commentID string, p auth.Principal, emoji string) error
- func (s *Store) DeleteDocument(ctx context.Context, id string) error
- func (s *Store) DeleteFolder(ctx context.Context, id string, p auth.Principal) error
- func (s *Store) DeleteGitHubConnection(ctx context.Context, userID string) error
- func (s *Store) DeleteGrant(ctx context.Context, resourceID, grantID string, deletedBy auth.Principal) error
- func (s *Store) DeletePin(ctx context.Context, p auth.Principal, rt, rid string) error
- func (s *Store) DirectDocumentGrantRole(ctx context.Context, documentID, userID string) (repo.Role, error)
- func (s *Store) EnsureUserByEmail(ctx context.Context, email string) (auth.Principal, error)
- func (s *Store) FinishCommentNotification(ctx context.Context, n repo.CommentNotification, retryAfter time.Duration) error
- func (s *Store) FinishDocumentAccessNotification(ctx context.Context, n repo.DocumentAccessNotification, ...) error
- func (s *Store) FinishDocumentAccessRequestNotification(ctx context.Context, n repo.DocumentAccessRequestNotification, ...) error
- func (s *Store) FolderAccessChain(ctx context.Context, p auth.Principal, folderID string) ([]repo.FolderAccess, error)
- func (s *Store) FolderHasGrants(ctx context.Context, folderID string) (bool, error)
- func (s *Store) GetComment(ctx context.Context, id string) (repo.Comment, error)
- func (s *Store) GetDocument(ctx context.Context, id string) (repo.Document, error)
- func (s *Store) GetFolder(ctx context.Context, id string) (repo.Folder, error)
- func (s *Store) GetGitHubConnection(ctx context.Context, userID string) (repo.GitHubConnection, error)
- func (s *Store) GetServiceAccount(ctx context.Context, id string) (repo.ServiceAccount, error)
- func (s *Store) GetServiceAccountByName(ctx context.Context, name string) (repo.ServiceAccount, error)
- func (s *Store) GetVersion(ctx context.Context, id string) (repo.Version, error)
- func (s *Store) GetVersionHTML(ctx context.Context, id string) ([]byte, error)
- func (s *Store) GoogleGroupMembershipSnapshot(ctx context.Context, userID string) (repo.GoogleGroupMembershipSnapshot, error)
- func (s *Store) HideFeaturedItem(ctx context.Context, p auth.Principal, rid string) error
- func (s *Store) IndexDocuments(ctx context.Context) (indexed int, err error)
- func (s *Store) IndexVersions(ctx context.Context) (indexed int, err error)
- func (s *Store) ListCLICredentials(ctx context.Context, userID string) ([]repo.CLICredential, error)
- func (s *Store) ListComments(ctx context.Context, documentID, status, versionID string) ([]repo.Comment, error)
- func (s *Store) ListDocumentKV(ctx context.Context, documentID string) (repo.DocumentKVSnapshot, error)
- func (s *Store) ListDocumentKVEvents(ctx context.Context, documentID string, afterRevision int64, limit int32) ([]repo.DocumentKVEvent, error)
- func (s *Store) ListDocumentLabels(ctx context.Context, documentID string) ([]string, error)
- func (s *Store) ListDocumentPresence(ctx context.Context, documentID string, maxAge time.Duration) ([]repo.DocumentKVEvent, error)
- func (s *Store) ListDocuments(ctx context.Context, p auth.Principal) ([]repo.Document, error)
- func (s *Store) ListDocumentsByLabel(ctx context.Context, p auth.Principal, label string) ([]repo.Document, error)
- func (s *Store) ListEffectiveAccess(ctx context.Context, rt, rid string) ([]repo.EffectiveAccessItem, error)
- func (s *Store) ListFolder(ctx context.Context, p auth.Principal, folderID, path string) ([]repo.FolderEntry, bool, *repo.Folder, error)
- func (s *Store) ListFolderDocuments(ctx context.Context, _ auth.Principal, folderID string) ([]repo.Document, error)
- func (s *Store) ListGitHubAuthorAccess(ctx context.Context, documentID, owner, repoName string, freshAfter time.Time) ([]repo.GitHubAuthorAccess, error)
- func (s *Store) ListGrants(ctx context.Context, resourceID string) ([]repo.Grant, error)
- func (s *Store) ListHiddenFeaturedItems(ctx context.Context, p auth.Principal) ([]string, error)
- func (s *Store) ListOwnershipTransfers(ctx context.Context, user auth.Principal) ([]repo.OwnershipTransfer, error)
- func (s *Store) ListPins(ctx context.Context, p auth.Principal) ([]repo.Pin, error)
- func (s *Store) ListServiceAccountKeys(ctx context.Context, saID string) ([]repo.ServiceAccountKey, error)
- func (s *Store) ListServiceAccounts(ctx context.Context, owner auth.Principal) ([]repo.ServiceAccount, error)
- func (s *Store) ListVersions(ctx context.Context, documentID string) ([]repo.Version, error)
- func (s *Store) MoveDocumentToFolder(ctx context.Context, _ auth.Principal, folderID, docID string) (bool, error)
- func (s *Store) MoveDocumentToRoot(ctx context.Context, folderID, docID string) error
- func (s *Store) NotificationPreferences(ctx context.Context, p auth.Principal, documentID string) (repo.NotificationPreferences, error)
- func (s *Store) PatchDocumentKV(ctx context.Context, documentID string, set map[string]json.RawMessage, ...) (repo.DocumentKVPatchResult, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) Pool() *pgxpool.Pool
- func (s *Store) PrincipalExists(ctx context.Context, p auth.Principal) (bool, error)
- func (s *Store) PutCommentReaction(ctx context.Context, commentID string, p auth.Principal, emoji string) error
- func (s *Store) PutPin(ctx context.Context, p auth.Principal, rt, rid string) error
- func (s *Store) RecordDocumentOpened(ctx context.Context, documentID string, p auth.Principal) error
- func (s *Store) RecordFolderOpened(ctx context.Context, folderID string, p auth.Principal) error
- func (s *Store) RecordGitHubRepoAccess(ctx context.Context, userID, owner, repoName string, canRead bool) error
- func (s *Store) RecordGoogleGroupMembershipFailure(ctx context.Context, userID, errorCode string, attemptedAt time.Time) error
- func (s *Store) ReplaceDocumentLabels(ctx context.Context, documentID string, labels []string, actor auth.Principal) ([]string, error)
- func (s *Store) ReplaceGoogleGroupMemberships(ctx context.Context, userID string, groups []repo.GoogleGroup, ...) error
- func (s *Store) RequestDocumentAccess(ctx context.Context, requester auth.Principal, documentID string) error
- func (s *Store) ReserveNotificationDelivery(ctx context.Context, userID string) (bool, error)
- func (s *Store) ResolveBearerToken(ctx context.Context, tokenHash string) (auth.Principal, error)
- func (s *Store) ResolveUser(ctx context.Context, id string) (auth.Principal, error)
- func (s *Store) RevokeCLICredential(ctx context.Context, userID, credentialID string) error
- func (s *Store) RevokeServiceAccountKey(ctx context.Context, saID, keyID string) error
- func (s *Store) RoleForDocument(ctx context.Context, p auth.Principal, documentID string) (repo.Role, error)
- func (s *Store) RoleForFolder(ctx context.Context, p auth.Principal, folderID string) (repo.Role, error)
- func (s *Store) SearchContacts(ctx context.Context, caller auth.Principal, query string) ([]auth.Principal, error)
- func (s *Store) SearchDocuments(ctx context.Context, p auth.Principal, search repo.DocumentSearch, ...) ([]repo.Document, error)
- func (s *Store) SearchFoldersByTitle(ctx context.Context, p auth.Principal, query string, includeOrgWide bool, ...) ([]repo.Folder, error)
- func (s *Store) SearchUsersByEmail(ctx context.Context, query string) ([]auth.Principal, error)
- func (s *Store) SetNotificationPreferences(ctx context.Context, p auth.Principal, documentID string, enabled bool) (repo.NotificationPreferences, error)
- func (s *Store) SetNotificationsEnabled(enabled bool)
- func (s *Store) UpdateComment(ctx context.Context, id string, update repo.CommentUpdate) (repo.Comment, error)
- func (s *Store) UpdateDocument(ctx context.Context, id, title string) (repo.Document, error)
- func (s *Store) UpdateFolder(ctx context.Context, id, title string, parent *string) (repo.Folder, error)
- func (s *Store) UpdateGrant(ctx context.Context, resourceID, grantID string, role repo.Role, ...) (repo.Grant, error)
- func (s *Store) UpdateServiceAccount(ctx context.Context, id, name string, disabled *bool) (repo.ServiceAccount, error)
- func (s *Store) UpsertGitHubConnection(ctx context.Context, c repo.GitHubConnection) error
- func (s *Store) UpsertGoogleGroup(ctx context.Context, group repo.GoogleGroup) error
- func (s *Store) UpsertGoogleUser(ctx context.Context, id, email, name, googleSub, pictureURL string) (auth.Principal, error)
- func (s *Store) UserByEmail(ctx context.Context, email string) (auth.Principal, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
func ConnectWithBlob ¶
func (*Store) AcceptOwnershipTransfer ¶
func (*Store) AppendDocumentEvent ¶
func (*Store) ClaimCommentNotification ¶
A lease outlives the sender's deadline and lets another process recover work after a crash. Successful delivery deletes the row immediately.
func (*Store) ClaimDocumentAccessNotification ¶
func (*Store) ClaimDocumentAccessRequestNotification ¶
func (*Store) CreateCLICredential ¶
func (*Store) CreateComment ¶
func (*Store) CreateCommentReply ¶
func (*Store) CreateDocument ¶
func (*Store) CreateFolder ¶
func (*Store) CreateGrant ¶
func (s *Store) CreateGrant(ctx context.Context, resourceType, resourceID string, principal auth.Principal, role repo.Role, grantedBy auth.Principal) (repo.Grant, error)
CreateGrant changes access without creating or updating user profiles.
func (*Store) CreateOwnershipTransfer ¶
func (*Store) CreateServiceAccount ¶
func (*Store) CreateServiceAccountKey ¶
func (*Store) CreateVersion ¶
func (*Store) CurrentDocumentKVRevision ¶
CurrentDocumentKVRevision returns the persisted high-water mark used to initialize the process-local event broker for a document.
func (*Store) DeclineOwnershipTransfer ¶
func (*Store) DeleteCommentReaction ¶
func (*Store) DeleteFolder ¶
func (*Store) DeleteGitHubConnection ¶
func (*Store) DeleteGrant ¶
func (*Store) DirectDocumentGrantRole ¶
func (*Store) EnsureUserByEmail ¶
func (*Store) FinishCommentNotification ¶
func (*Store) FinishDocumentAccessNotification ¶
func (*Store) FinishDocumentAccessRequestNotification ¶
func (*Store) FolderAccessChain ¶
func (s *Store) FolderAccessChain(ctx context.Context, p auth.Principal, folderID string) ([]repo.FolderAccess, error)
FolderAccessChain returns the folder's ancestor chain (root first, the folder itself last) together with the principal's effective role at each level, resolved in a single query. It returns repo.ErrNotFound when the folder does not exist; a chain entry's role is repo.RoleNone when the principal has no access at that level.
func (*Store) FolderHasGrants ¶
func (*Store) GetComment ¶
func (*Store) GetDocument ¶
func (*Store) GetGitHubConnection ¶
func (*Store) GetServiceAccount ¶
func (*Store) GetServiceAccountByName ¶
func (*Store) GetVersion ¶
func (*Store) GetVersionHTML ¶
func (*Store) GoogleGroupMembershipSnapshot ¶
func (*Store) HideFeaturedItem ¶
func (*Store) IndexDocuments ¶ added in v0.3.0
IndexDocuments gives a search vector to documents that were created before documents had one. IndexDocuments returns the number of documents that it indexed.
func (*Store) IndexVersions ¶
IndexVersions gives search text to current versions that were created before content search. Each batch locks its versions, so all servers can run it at the same time. A version that cannot be read is skipped until the next run. IndexVersions returns the number of versions that it indexed.
func (*Store) ListCLICredentials ¶
func (*Store) ListComments ¶
func (*Store) ListDocumentKV ¶
func (*Store) ListDocumentKVEvents ¶
func (*Store) ListDocumentLabels ¶
func (*Store) ListDocumentPresence ¶
func (*Store) ListDocuments ¶
func (*Store) ListDocumentsByLabel ¶
func (*Store) ListEffectiveAccess ¶
func (*Store) ListFolder ¶
func (*Store) ListFolderDocuments ¶
func (*Store) ListGitHubAuthorAccess ¶
func (*Store) ListGrants ¶
func (*Store) ListHiddenFeaturedItems ¶
func (*Store) ListOwnershipTransfers ¶
func (*Store) ListServiceAccountKeys ¶
func (*Store) ListServiceAccounts ¶
func (*Store) ListVersions ¶
func (*Store) MoveDocumentToFolder ¶
func (*Store) MoveDocumentToRoot ¶
func (*Store) NotificationPreferences ¶
func (*Store) PatchDocumentKV ¶
func (*Store) PrincipalExists ¶
func (*Store) PutCommentReaction ¶
func (*Store) RecordDocumentOpened ¶
func (*Store) RecordFolderOpened ¶
func (*Store) RecordGitHubRepoAccess ¶
func (*Store) RecordGoogleGroupMembershipFailure ¶
func (*Store) ReplaceDocumentLabels ¶
func (*Store) ReplaceGoogleGroupMemberships ¶
func (*Store) RequestDocumentAccess ¶
func (s *Store) RequestDocumentAccess(ctx context.Context, requester auth.Principal, documentID string) error
RequestDocumentAccess deliberately returns no existence or owner detail. A repeated request within 24 hours is accepted but does not notify again.
func (*Store) ReserveNotificationDelivery ¶
A database gate applies across replicas, separately from Slack's rate limits.