Documentation
¶
Overview ¶
Package store is the single entry point to Githome's metadata database. It supports PostgreSQL (jackc/pgx/v5 via database/sql) and SQLite (modernc.org/sqlite, pure Go, no cgo) behind one dialect-aware Store. The same embedded migrations run on both.
Write-throughput ceiling ¶
SQLite serializes all writers at the database level: only one write transaction runs at a time. On modern NVMe storage each committed write transaction costs ~0.1–0.5 ms (one fsync), giving a ceiling of roughly 2–10K writes/sec for single-statement mutations. The multi-statement write path for an issue or pull request (number allocation, row insert, label/assignee associations, counter bump, event + job batch) sits comfortably inside that ceiling at development scale but tops out below the 500 RPS SLO target.
Postgres lifts this ceiling: each write transaction acquires row-level locks (not a database-wide write lock), so unrelated writes proceed concurrently and the throughput scales with connection-pool depth and hardware IOPS. Githome targets Postgres for production at scale; SQLite serves development, tests, and single-user instances where the ceiling is not a bottleneck.
Index ¶
- Variables
- func EncodeCursor(c IssueCursor) string
- func EncodePullCursor(c PullCursor) string
- type AuthCodeRow
- type BranchProtectionRow
- type CheckRunAnnotationRow
- type CheckRunRow
- type CheckSuiteRow
- type CodeDoc
- type CodeHit
- type CodeSearch
- type CollaboratorRow
- type CommentRow
- type CommitStatusRow
- type DeviceCodeRow
- type Dialect
- type EventFilter
- type EventRow
- type GistCommentRow
- type GistFileRow
- type GistRow
- type GitHubAppRow
- type InstallationRow
- type IssueCursor
- type IssueEventRow
- type IssueFilter
- type IssueRow
- type IssueSearch
- type JobRow
- type LabelRow
- type MilestoneCount
- type MilestoneRow
- type NotificationThreadRow
- type OAuthAppRow
- type OrgMemberRow
- type ProfileUpdate
- type PullCheckStateRow
- type PullCursor
- type PullFilter
- type PullRow
- type ReactionRollup
- type ReactionRow
- type ReleaseAssetRow
- type ReleaseRow
- type RepoPatch
- type RepoRow
- type RepoSearch
- type ReviewCommentRow
- type ReviewRow
- type SSHKeyRow
- type Store
- func (s *Store) AddReviewRequests(ctx context.Context, pullPK int64, reviewerPKs []int64) error
- func (s *Store) AllocDBID(ctx context.Context) (int64, error)
- func (s *Store) AssigneesByIssuePKs(ctx context.Context, issuePKs []int64) (map[int64][]int64, error)
- func (s *Store) BranchProtectionByPattern(ctx context.Context, repoPK int64, pattern string) (*BranchProtectionRow, error)
- func (s *Store) BulkLoad(ctx context.Context, fn func() error) error
- func (s *Store) BumpTokenLastUsed(ctx context.Context, at map[int64]time.Time) error
- func (s *Store) ClaimJob(ctx context.Context) (*JobRow, error)
- func (s *Store) Close() error
- func (s *Store) CodeIndexHead(ctx context.Context, repoPK int64) (string, error)
- func (s *Store) CodeIndexTruncated(ctx context.Context, repoPKs []int64) (bool, error)
- func (s *Store) CollaboratorByRepo(ctx context.Context, repoPK, userPK int64) (*CollaboratorRow, error)
- func (s *Store) CollaboratorsByRepo(ctx context.Context, repoPK int64) ([]*CollaboratorRow, error)
- func (s *Store) CommentsByIssuePKs(ctx context.Context, issuePKs []int64, perIssue int) (map[int64][]CommentRow, error)
- func (s *Store) CompleteJob(ctx context.Context, pk int64) error
- func (s *Store) ConsumeAuthCode(ctx context.Context, codeHash []byte) (*AuthCodeRow, error)
- func (s *Store) CountForks(ctx context.Context, pk int64) (int64, error)
- func (s *Store) CountIssues(ctx context.Context, repoPK int64, f IssueFilter) (int, error)
- func (s *Store) CountPulls(ctx context.Context, repoPK int64, f PullFilter) (int, error)
- func (s *Store) CountSearchCode(ctx context.Context, q CodeSearch) (int, error)
- func (s *Store) CountSearchIssues(ctx context.Context, q IssueSearch) (int, error)
- func (s *Store) CountSearchRepositories(ctx context.Context, q RepoSearch) (int, error)
- func (s *Store) CountSearchUsers(ctx context.Context, q UserSearch) (int, error)
- func (s *Store) CountTeamMembers(ctx context.Context, teamPK int64) (int, error)
- func (s *Store) CountTeamRepos(ctx context.Context, teamPK int64) (int, error)
- func (s *Store) DB() *sql.DB
- func (s *Store) DeleteBranchProtection(ctx context.Context, repoPK int64, pattern string) error
- func (s *Store) DeleteCollaborator(ctx context.Context, repoPK, userPK int64) error
- func (s *Store) DeleteComment(ctx context.Context, pk int64) error
- func (s *Store) DeleteDeviceCode(ctx context.Context, pk int64) error
- func (s *Store) DeleteFollow(ctx context.Context, followerPK, targetPK int64) error
- func (s *Store) DeleteGist(ctx context.Context, gistID string) error
- func (s *Store) DeleteGistComment(ctx context.Context, commentPK int64) error
- func (s *Store) DeleteLabel(ctx context.Context, pk int64) error
- func (s *Store) DeleteMilestone(ctx context.Context, pk int64) error
- func (s *Store) DeleteNotificationThread(ctx context.Context, pk int64) error
- func (s *Store) DeleteOrgMember(ctx context.Context, orgPK, userPK int64) error
- func (s *Store) DeleteReaction(ctx context.Context, subjectType string, subjectPK, dbID int64) error
- func (s *Store) DeleteRelease(ctx context.Context, pk int64) error
- func (s *Store) DeleteReleaseAsset(ctx context.Context, pk int64) error
- func (s *Store) DeleteReview(ctx context.Context, pk int64) error
- func (s *Store) DeleteReviewComment(ctx context.Context, pk int64) error
- func (s *Store) DeleteSSHKey(ctx context.Context, pk int64) error
- func (s *Store) DeleteStar(ctx context.Context, userPK, repoPK int64) error
- func (s *Store) DeleteSubscription(ctx context.Context, userPK, repoPK int64) error
- func (s *Store) DeleteTeam(ctx context.Context, pk int64) error
- func (s *Store) DeleteTeamMember(ctx context.Context, teamPK, userPK int64) error
- func (s *Store) DeleteTeamRepo(ctx context.Context, teamPK, repoPK int64) error
- func (s *Store) DeleteUserToken(ctx context.Context, pk, userPK int64) error
- func (s *Store) DeleteWebhook(ctx context.Context, repoPK, dbID int64) error
- func (s *Store) DeployKeysByRepo(ctx context.Context, repoPK int64) ([]*SSHKeyRow, error)
- func (s *Store) DeviceCodeByHash(ctx context.Context, hash []byte) (*DeviceCodeRow, error)
- func (s *Store) DeviceCodeByUserCode(ctx context.Context, userCode string) (*DeviceCodeRow, error)
- func (s *Store) Dialect() Dialect
- func (s *Store) DismissReview(ctx context.Context, pk int64, message string) error
- func (s *Store) EnqueueJob(ctx context.Context, j *JobRow) (deduped bool, err error)
- func (s *Store) EnsureCheckSuite(ctx context.Context, repoPK int64, headSHA, appSlug string) (*CheckSuiteRow, error)
- func (s *Store) FailJob(ctx context.Context, pk int64, attempts, maxAttempts int, reason string, ...) error
- func (s *Store) FollowerCount(ctx context.Context, targetPK int64) (int, error)
- func (s *Store) FollowersByUser(ctx context.Context, targetPK int64, limit, offset int) ([]*UserRow, error)
- func (s *Store) FollowingByUser(ctx context.Context, followerPK int64, limit, offset int) ([]*UserRow, error)
- func (s *Store) FollowingCount(ctx context.Context, followerPK int64) (int, error)
- func (s *Store) ForksOf(ctx context.Context, pk int64) ([]*RepoRow, error)
- func (s *Store) GetCheckRun(ctx context.Context, dbID int64) (*CheckRunRow, error)
- func (s *Store) GetCheckSuiteByDBID(ctx context.Context, dbID int64) (*CheckSuiteRow, error)
- func (s *Store) GetComment(ctx context.Context, dbID int64) (*CommentRow, error)
- func (s *Store) GetCommentByPK(ctx context.Context, pk int64) (*CommentRow, error)
- func (s *Store) GetDeliveryByPK(ctx context.Context, pk int64) (*WebhookDeliveryRow, error)
- func (s *Store) GetDeliveryForWebhook(ctx context.Context, webhookPK, dbID int64) (*WebhookDeliveryRow, error)
- func (s *Store) GetEventByPK(ctx context.Context, pk int64) (*EventRow, error)
- func (s *Store) GetGistByID(ctx context.Context, gistID string) (*GistRow, error)
- func (s *Store) GetGistComment(ctx context.Context, commentPK int64) (*GistCommentRow, error)
- func (s *Store) GetIssueByDBID(ctx context.Context, dbID int64) (*IssueRow, error)
- func (s *Store) GetIssueByNumber(ctx context.Context, repoPK, number int64) (*IssueRow, error)
- func (s *Store) GetIssueByPK(ctx context.Context, pk int64) (*IssueRow, error)
- func (s *Store) GetLabel(ctx context.Context, repoPK int64, name string) (*LabelRow, error)
- func (s *Store) GetLabelByDBID(ctx context.Context, dbID int64) (*LabelRow, error)
- func (s *Store) GetLatestRelease(ctx context.Context, repoPK int64) (*ReleaseRow, error)
- func (s *Store) GetMilestoneByDBID(ctx context.Context, dbID int64) (*MilestoneRow, error)
- func (s *Store) GetMilestoneByNumber(ctx context.Context, repoPK, number int64) (*MilestoneRow, error)
- func (s *Store) GetMilestoneByPK(ctx context.Context, pk int64) (*MilestoneRow, error)
- func (s *Store) GetPullByDBID(ctx context.Context, dbID int64) (*PullRow, error)
- func (s *Store) GetPullByIssuePK(ctx context.Context, issuePK int64) (*PullRow, error)
- func (s *Store) GetPullCheckState(ctx context.Context, pullPK int64) (*PullCheckStateRow, error)
- func (s *Store) GetReleaseAssetByID(ctx context.Context, dbID int64) (*ReleaseAssetRow, error)
- func (s *Store) GetReleaseByID(ctx context.Context, repoPK, dbID int64) (*ReleaseRow, error)
- func (s *Store) GetReleaseByPK(ctx context.Context, pk int64) (*ReleaseRow, error)
- func (s *Store) GetReleaseByTag(ctx context.Context, repoPK int64, tag string) (*ReleaseRow, error)
- func (s *Store) GetReviewByDBID(ctx context.Context, dbID int64) (*ReviewRow, error)
- func (s *Store) GetReviewByPK(ctx context.Context, pk int64) (*ReviewRow, error)
- func (s *Store) GetReviewComment(ctx context.Context, dbID int64) (*ReviewCommentRow, error)
- func (s *Store) GetReviewCommentByPK(ctx context.Context, pk int64) (*ReviewCommentRow, error)
- func (s *Store) GetWebhookByPK(ctx context.Context, pk int64) (*WebhookRow, error)
- func (s *Store) GetWebhookForRepo(ctx context.Context, repoPK, dbID int64) (*WebhookRow, error)
- func (s *Store) GitHubAppByClientID(ctx context.Context, clientID string) (*GitHubAppRow, error)
- func (s *Store) GitHubAppByPK(ctx context.Context, pk int64) (*GitHubAppRow, error)
- func (s *Store) IncrementAssetDownloadCount(ctx context.Context, pk int64) error
- func (s *Store) InsertAuthCode(ctx context.Context, a *AuthCodeRow) error
- func (s *Store) InsertCheckRun(ctx context.Context, r *CheckRunRow) error
- func (s *Store) InsertCheckRunAnnotations(ctx context.Context, checkRunPK int64, anns []CheckRunAnnotationRow) error
- func (s *Store) InsertComment(ctx context.Context, c *CommentRow) error
- func (s *Store) InsertCommitStatus(ctx context.Context, st *CommitStatusRow) error
- func (s *Store) InsertDelivery(ctx context.Context, d *WebhookDeliveryRow) error
- func (s *Store) InsertDeviceCode(ctx context.Context, d *DeviceCodeRow) error
- func (s *Store) InsertEvent(ctx context.Context, e *EventRow) error
- func (s *Store) InsertEventAndJob(ctx context.Context, e *EventRow, jobKind string, ...) error
- func (s *Store) InsertFollow(ctx context.Context, followerPK, targetPK int64) error
- func (s *Store) InsertGist(ctx context.Context, g *GistRow) error
- func (s *Store) InsertGistComment(ctx context.Context, c *GistCommentRow) error
- func (s *Store) InsertGitHubApp(ctx context.Context, a *GitHubAppRow) error
- func (s *Store) InsertInstallation(ctx context.Context, in *InstallationRow) error
- func (s *Store) InsertInstallationRepo(ctx context.Context, instPK, repoPK int64) error
- func (s *Store) InsertLabel(ctx context.Context, l *LabelRow) error
- func (s *Store) InsertMilestone(ctx context.Context, m *MilestoneRow) error
- func (s *Store) InsertOAuthApp(ctx context.Context, a *OAuthAppRow) error
- func (s *Store) InsertReaction(ctx context.Context, r *ReactionRow) (created bool, err error)
- func (s *Store) InsertRelease(ctx context.Context, r *ReleaseRow) error
- func (s *Store) InsertReleaseAsset(ctx context.Context, a *ReleaseAssetRow) error
- func (s *Store) InsertRepo(ctx context.Context, r *RepoRow) error
- func (s *Store) InsertSSHKey(ctx context.Context, k *SSHKeyRow) error
- func (s *Store) InsertStar(ctx context.Context, userPK, repoPK int64) error
- func (s *Store) InsertTeam(ctx context.Context, t *TeamRow) error
- func (s *Store) InsertToken(ctx context.Context, t *TokenRow) error
- func (s *Store) InsertUser(ctx context.Context, u *UserRow) error
- func (s *Store) InsertUserWithPassword(ctx context.Context, login, email, hash string) (int64, error)
- func (s *Store) InsertWebhook(ctx context.Context, w *WebhookRow) error
- func (s *Store) Install(ctx context.Context) error
- func (s *Store) InstallationByAppAndAccount(ctx context.Context, appPK, accountPK int64) (*InstallationRow, error)
- func (s *Store) InstallationByDBID(ctx context.Context, dbID int64) (*InstallationRow, error)
- func (s *Store) InstallationByPK(ctx context.Context, pk int64) (*InstallationRow, error)
- func (s *Store) InstallationRepoPKs(ctx context.Context, instPK int64) ([]int64, error)
- func (s *Store) InstallationsByAppPK(ctx context.Context, appPK int64) ([]*InstallationRow, error)
- func (s *Store) IsAssigned(ctx context.Context, issuePK, userPK int64) (bool, error)
- func (s *Store) IsFollowing(ctx context.Context, followerPK, targetPK int64) (bool, error)
- func (s *Store) IsGistStarred(ctx context.Context, gistPK, userPK int64) (bool, error)
- func (s *Store) IsStarred(ctx context.Context, userPK, repoPK int64) (bool, error)
- func (s *Store) IssueListVersion(ctx context.Context, repoPK int64, f IssueFilter) (int, string, error)
- func (s *Store) IssuesByPKs(ctx context.Context, pks []int64) (map[int64]*IssueRow, error)
- func (s *Store) LabelsByIssue(ctx context.Context, issuePK int64) ([]LabelRow, error)
- func (s *Store) LabelsByIssuePKs(ctx context.Context, issuePKs []int64) (map[int64][]LabelRow, error)
- func (s *Store) LabelsByNames(ctx context.Context, repoPK int64, names []string) ([]LabelRow, error)
- func (s *Store) ListActiveWebhooks(ctx context.Context, repoPK int64) ([]WebhookRow, error)
- func (s *Store) ListAllReviewComments(ctx context.Context, repoPK int64) ([]ReviewCommentRow, error)
- func (s *Store) ListAssigneePKs(ctx context.Context, issuePK int64) ([]int64, error)
- func (s *Store) ListCheckRunAnnotations(ctx context.Context, checkRunPK int64) ([]CheckRunAnnotationRow, error)
- func (s *Store) ListCheckRunsForRef(ctx context.Context, repoPK int64, headSHA string) ([]CheckRunRow, error)
- func (s *Store) ListCheckRunsForSuite(ctx context.Context, suitePK int64) ([]CheckRunRow, error)
- func (s *Store) ListCheckRunsForSuites(ctx context.Context, suitePKs []int64) (map[int64][]CheckRunRow, error)
- func (s *Store) ListCheckSuites(ctx context.Context, repoPK int64, headSHA string) ([]CheckSuiteRow, error)
- func (s *Store) ListCommitStatuses(ctx context.Context, repoPK int64, sha string) ([]CommitStatusRow, error)
- func (s *Store) ListDeliveries(ctx context.Context, webhookPK int64, limit int) ([]WebhookDeliveryRow, error)
- func (s *Store) ListEvents(ctx context.Context, f EventFilter) ([]EventRow, error)
- func (s *Store) ListGistComments(ctx context.Context, gistPK int64) ([]GistCommentRow, error)
- func (s *Store) ListGistsByOwner(ctx context.Context, ownerPK int64, page, perPage int) ([]*GistRow, int, error)
- func (s *Store) ListIssueComments(ctx context.Context, issuePK int64, limit, offset int) ([]CommentRow, error)
- func (s *Store) ListIssueCommentsAfter(ctx context.Context, issuePK int64, createdAt time.Time, afterPK int64, ...) ([]CommentRow, error)
- func (s *Store) ListIssueEvents(ctx context.Context, issuePK int64) ([]IssueEventRow, error)
- func (s *Store) ListIssues(ctx context.Context, repoPK int64, f IssueFilter) ([]IssueRow, error)
- func (s *Store) ListIssuesPage(ctx context.Context, repoPK int64, f IssueFilter) ([]IssueRow, bool, error)
- func (s *Store) ListJobs(ctx context.Context) ([]JobRow, error)
- func (s *Store) ListLabels(ctx context.Context, repoPK int64) ([]LabelRow, error)
- func (s *Store) ListMilestones(ctx context.Context, repoPK int64, state string) ([]MilestoneRow, error)
- func (s *Store) ListNotificationThreads(ctx context.Context, userPK, repoPK int64, all bool, limit, offset int) ([]*NotificationThreadRow, int, error)
- func (s *Store) ListPublicGists(ctx context.Context, page, perPage int) ([]*GistRow, int, error)
- func (s *Store) ListPublicRepos(ctx context.Context, sinceDBID int64, limit int) ([]*RepoRow, error)
- func (s *Store) ListPulls(ctx context.Context, repoPK int64, f PullFilter, limit, offset int) ([]PullRow, error)
- func (s *Store) ListPullsPage(ctx context.Context, repoPK int64, f PullFilter, cursor *PullCursor, limit int) ([]PullRow, bool, error)
- func (s *Store) ListReactions(ctx context.Context, subjectType string, subjectPK int64) ([]ReactionRow, error)
- func (s *Store) ListReleaseAssets(ctx context.Context, releasePK int64) ([]ReleaseAssetRow, error)
- func (s *Store) ListReleases(ctx context.Context, repoPK int64, includeDrafts bool, limit, offset int) ([]ReleaseRow, error)
- func (s *Store) ListReviewComments(ctx context.Context, pullPK int64) ([]ReviewCommentRow, error)
- func (s *Store) ListReviewCommentsForReview(ctx context.Context, reviewPK int64) ([]ReviewCommentRow, error)
- func (s *Store) ListReviewRequestPKs(ctx context.Context, pullPK int64) ([]int64, error)
- func (s *Store) ListReviews(ctx context.Context, pullPK int64) ([]ReviewRow, error)
- func (s *Store) ListStarredGists(ctx context.Context, userPK int64, page, perPage int) ([]*GistRow, int, error)
- func (s *Store) ListUsers(ctx context.Context, sinceDBID int64, limit int) ([]*UserRow, error)
- func (s *Store) ListWebhooks(ctx context.Context, repoPK int64) ([]WebhookRow, error)
- func (s *Store) MarkNotificationThreadRead(ctx context.Context, pk int64) error
- func (s *Store) MarkNotificationThreadsRead(ctx context.Context, userPK, repoPK int64) error
- func (s *Store) Migrate(ctx context.Context) error
- func (s *Store) MilestoneIssueCounts(ctx context.Context, milestonePK int64) (open, closed int, err error)
- func (s *Store) MilestoneIssueCountsByPKs(ctx context.Context, pks []int64) (map[int64]MilestoneCount, error)
- func (s *Store) MilestonesByPKs(ctx context.Context, pks []int64) (map[int64]*MilestoneRow, error)
- func (s *Store) NotificationThreadByPK(ctx context.Context, pk int64) (*NotificationThreadRow, error)
- func (s *Store) OAuthAppByClientID(ctx context.Context, clientID string) (*OAuthAppRow, error)
- func (s *Store) OpenPullsByBaseRef(ctx context.Context, repoPK int64, baseRef string) ([]PullRow, error)
- func (s *Store) OpenPullsByHeadRef(ctx context.Context, repoPK int64, headRef string) ([]PullRow, error)
- func (s *Store) OpenPullsByHeadSHA(ctx context.Context, repoPK int64, headSHA string) ([]PullRow, error)
- func (s *Store) OrgMemberRole(ctx context.Context, orgPK, userPK int64) (string, error)
- func (s *Store) OrgMembersByOrg(ctx context.Context, orgPK int64) ([]*OrgMemberRow, error)
- func (s *Store) OrgMembersByUser(ctx context.Context, userPK int64) ([]*OrgMemberRow, error)
- func (s *Store) PasswordHashFor(ctx context.Context, login string) (pk int64, hash string, err error)
- func (s *Store) PendingReviewFor(ctx context.Context, pullPK, userPK int64) (*ReviewRow, error)
- func (s *Store) Ping(ctx context.Context) error
- func (s *Store) PruneDeliveries(ctx context.Context, before time.Time) (int64, error)
- func (s *Store) PullListVersion(ctx context.Context, repoPK int64, f PullFilter) (int, string, error)
- func (s *Store) PullNumberByPK(ctx context.Context, pullPK int64) (int64, error)
- func (s *Store) ReactionRollupFor(ctx context.Context, subjectType string, subjectPK int64) (ReactionRollup, error)
- func (s *Store) ReactionRollupsBySubjectPKs(ctx context.Context, subjectType string, subjectPKs []int64) (map[int64]ReactionRollup, error)
- func (s *Store) RecomputeIssueCommentCounts(ctx context.Context, repoPK int64) error
- func (s *Store) RemoveReviewRequests(ctx context.Context, pullPK int64, reviewerPKs []int64) error
- func (s *Store) ReplaceCodeDocs(ctx context.Context, repoPK int64, headSHA string, truncated bool, ...) error
- func (s *Store) RepoByDBID(ctx context.Context, dbID int64) (*RepoRow, error)
- func (s *Store) RepoByOwnerName(ctx context.Context, owner, name string) (*RepoRow, error)
- func (s *Store) RepoByPK(ctx context.Context, pk int64) (*RepoRow, error)
- func (s *Store) RepoByRedirect(ctx context.Context, owner, name string) (*RepoRow, error)
- func (s *Store) ReposByCollaborator(ctx context.Context, userPK int64) ([]*RepoRow, error)
- func (s *Store) ReposByOwner(ctx context.Context, ownerPK int64) ([]*RepoRow, error)
- func (s *Store) ReposByTeamMember(ctx context.Context, userPK int64) ([]*RepoRow, error)
- func (s *Store) ReviewRequestsByPullPKs(ctx context.Context, pullPKs []int64) (map[int64][]int64, error)
- func (s *Store) Rollback(ctx context.Context, n int) error
- func (s *Store) SSHKeyByDBID(ctx context.Context, dbID int64) (*SSHKeyRow, error)
- func (s *Store) SSHKeyByPK(ctx context.Context, pk int64) (*SSHKeyRow, error)
- func (s *Store) SSHKeysByUser(ctx context.Context, userPK int64) ([]*SSHKeyRow, error)
- func (s *Store) SearchCode(ctx context.Context, q CodeSearch) ([]CodeHit, error)
- func (s *Store) SearchIssues(ctx context.Context, q IssueSearch) ([]IssueRow, error)
- func (s *Store) SearchRepositories(ctx context.Context, q RepoSearch) ([]RepoRow, error)
- func (s *Store) SearchUsers(ctx context.Context, q UserSearch) ([]UserRow, error)
- func (s *Store) SetCheckSuiteState(ctx context.Context, pk int64, status string, conclusion *string) error
- func (s *Store) SetDeviceInterval(ctx context.Context, pk int64, interval int) error
- func (s *Store) SetDevicePolled(ctx context.Context, pk int64, at time.Time) error
- func (s *Store) SetDeviceState(ctx context.Context, pk int64, state string, userPK int64) error
- func (s *Store) SetEventPayload(ctx context.Context, pk int64, payload string) error
- func (s *Store) SetMergeability(ctx context.Context, issuePK int64, mergeable *bool, state string, ...) error
- func (s *Store) SetNextIssueNumber(ctx context.Context, repoPK, next int64) error
- func (s *Store) SetNotificationThreadSubscription(ctx context.Context, pk int64, subscribed, ignored bool) error
- func (s *Store) SetPasswordHash(ctx context.Context, userPK int64, hash string) error
- func (s *Store) SetThreadResolved(ctx context.Context, rootPK int64, resolved bool, resolverPK *int64) error
- func (s *Store) SetWebhookLastResponse(ctx context.Context, pk int64, summary string) error
- func (s *Store) SoftDeleteRepo(ctx context.Context, pk int64) error
- func (s *Store) StarCount(ctx context.Context, repoPK int64) (int, error)
- func (s *Store) StarGist(ctx context.Context, gistPK, userPK int64) error
- func (s *Store) StargazersByRepo(ctx context.Context, repoPK int64, limit, offset int) ([]*UserRow, error)
- func (s *Store) StarredByUser(ctx context.Context, userPK int64, limit, offset int) ([]*RepoRow, error)
- func (s *Store) SubscriptionByRepo(ctx context.Context, userPK, repoPK int64) (*SubscriptionRow, error)
- func (s *Store) SubscriptionsByUser(ctx context.Context, userPK int64, limit, offset int) ([]*RepoRow, error)
- func (s *Store) TeamByPK(ctx context.Context, pk int64) (*TeamRow, error)
- func (s *Store) TeamBySlug(ctx context.Context, orgPK int64, slug string) (*TeamRow, error)
- func (s *Store) TeamMemberRole(ctx context.Context, teamPK, userPK int64) (string, error)
- func (s *Store) TeamRepoPermission(ctx context.Context, teamPK, repoPK int64) (string, error)
- func (s *Store) TeamsByOrg(ctx context.Context, orgPK int64) ([]*TeamRow, error)
- func (s *Store) TokenByHash(ctx context.Context, hash []byte) (*TokenRow, error)
- func (s *Store) TokensForUser(ctx context.Context, userPK int64) ([]*TokenRow, error)
- func (s *Store) TouchRepoPushedAt(ctx context.Context, pk int64, at time.Time) error
- func (s *Store) UnstarGist(ctx context.Context, gistPK, userPK int64) error
- func (s *Store) UpdateCheckRun(ctx context.Context, r *CheckRunRow) error
- func (s *Store) UpdateComment(ctx context.Context, c *CommentRow) error
- func (s *Store) UpdateGist(ctx context.Context, gistPK int64, description *string, ...) error
- func (s *Store) UpdateGistComment(ctx context.Context, commentPK int64, body string) error
- func (s *Store) UpdateLabel(ctx context.Context, l *LabelRow) error
- func (s *Store) UpdateMilestone(ctx context.Context, m *MilestoneRow) error
- func (s *Store) UpdateProfile(ctx context.Context, userPK int64, u ProfileUpdate) error
- func (s *Store) UpdatePullDraft(ctx context.Context, pullPK int64, draft bool) error
- func (s *Store) UpdateRelease(ctx context.Context, r *ReleaseRow) error
- func (s *Store) UpdateReleaseAsset(ctx context.Context, a *ReleaseAssetRow) error
- func (s *Store) UpdateRepo(ctx context.Context, pk int64, p RepoPatch) (*RepoRow, error)
- func (s *Store) UpdateRepoTopics(ctx context.Context, repoPK int64, topicsJSON string) error
- func (s *Store) UpdateReviewBody(ctx context.Context, pk int64, body string) error
- func (s *Store) UpdateReviewCommentBody(ctx context.Context, pk int64, body string) error
- func (s *Store) UpdateTeam(ctx context.Context, pk int64, name, description, privacy, permission *string) (*TeamRow, error)
- func (s *Store) UpdateWebhook(ctx context.Context, w *WebhookRow) error
- func (s *Store) UpsertBranchProtection(ctx context.Context, r *BranchProtectionRow) error
- func (s *Store) UpsertCollaborator(ctx context.Context, repoPK, userPK int64, permission string) error
- func (s *Store) UpsertNotificationThread(ctx context.Context, r *NotificationThreadRow) error
- func (s *Store) UpsertOrgMember(ctx context.Context, orgPK, userPK int64, role string) error
- func (s *Store) UpsertPullCheckState(ctx context.Context, pullPK int64, decision *string, rollup string, ...) error
- func (s *Store) UpsertRepoRedirect(ctx context.Context, oldOwner, oldName string, repoPK int64) error
- func (s *Store) UpsertSubscription(ctx context.Context, userPK, repoPK int64, subscribed, ignored bool) error
- func (s *Store) UpsertTeamMember(ctx context.Context, teamPK, userPK int64, role string) error
- func (s *Store) UpsertTeamRepo(ctx context.Context, teamPK, repoPK int64, permission string) error
- func (s *Store) UserByLogin(ctx context.Context, login string) (*UserRow, error)
- func (s *Store) UserByPK(ctx context.Context, pk int64) (*UserRow, error)
- func (s *Store) UserLoginExists(ctx context.Context, login string) (bool, error)
- func (s *Store) UsersByPKs(ctx context.Context, pks []int64) (map[int64]*UserRow, error)
- func (s *Store) Version(ctx context.Context) (int64, error)
- func (s *Store) VisibleRepoPKs(ctx context.Context, viewerPK int64, ownerPKs []int64) ([]int64, error)
- func (s *Store) WatcherCount(ctx context.Context, repoPK int64) (int, error)
- func (s *Store) WatchersByRepo(ctx context.Context, repoPK int64, limit, offset int) ([]*UserRow, error)
- func (s *Store) WithTx(ctx context.Context, fn func(*Tx) error) error
- type SubscriptionRow
- type TeamRow
- type TokenRow
- type Tx
- func (t *Tx) AddAssignees(ctx context.Context, issuePK int64, userPKs []int64) error
- func (t *Tx) AddLabels(ctx context.Context, issuePK int64, labelPKs []int64) error
- func (t *Tx) AdjustOpenIssuesCount(ctx context.Context, repoPK int64, delta int) error
- func (t *Tx) AllocIssueNumber(ctx context.Context, repoPK int64) (int64, error)
- func (t *Tx) AttachLabels(ctx context.Context, issuePK int64, labelPKs []int64) error
- func (t *Tx) BumpCommentsCount(ctx context.Context, issuePK int64, delta int) error
- func (t *Tx) DetachLabel(ctx context.Context, issuePK, labelPK int64) error
- func (t *Tx) InsertComment(ctx context.Context, c *CommentRow) error
- func (t *Tx) InsertEvent(ctx context.Context, e *EventRow) error
- func (t *Tx) InsertIssue(ctx context.Context, iss *IssueRow) error
- func (t *Tx) InsertIssueEvent(ctx context.Context, e *IssueEventRow) error
- func (t *Tx) InsertLabel(ctx context.Context, l *LabelRow) error
- func (t *Tx) InsertPull(ctx context.Context, p *PullRow) error
- func (t *Tx) InsertReview(ctx context.Context, r *ReviewRow) error
- func (t *Tx) InsertReviewComment(ctx context.Context, c *ReviewCommentRow) error
- func (t *Tx) MarkMerged(ctx context.Context, pullPK int64, mergerPK int64, mergeCommitSHA string, ...) error
- func (t *Tx) RemoveAssignees(ctx context.Context, issuePK int64, userPKs []int64) error
- func (t *Tx) RemoveLabels(ctx context.Context, issuePK int64, labelPKs []int64) error
- func (t *Tx) ReplaceAssignees(ctx context.Context, issuePK int64, userPKs []int64) error
- func (t *Tx) ReplaceLabels(ctx context.Context, issuePK int64, labelPKs []int64) error
- func (t *Tx) SeedComment(ctx context.Context, c *CommentRow) error
- func (t *Tx) SeedCommitStatus(ctx context.Context, st *CommitStatusRow) error
- func (t *Tx) SeedIssue(ctx context.Context, iss *IssueRow) error
- func (t *Tx) SeedIssueEvent(ctx context.Context, e *IssueEventRow) error
- func (t *Tx) SeedIssueEventsBulk(ctx context.Context, rows []IssueEventRow) error
- func (t *Tx) SeedLabel(ctx context.Context, l *LabelRow) error
- func (t *Tx) SeedMilestone(ctx context.Context, m *MilestoneRow) error
- func (t *Tx) SeedPull(ctx context.Context, p *PullRow) error
- func (t *Tx) SeedReaction(ctx context.Context, r *ReactionRow) error
- func (t *Tx) SeedReactionsBulk(ctx context.Context, rows []ReactionRow) error
- func (t *Tx) SeedRepo(ctx context.Context, r *RepoRow) error
- func (t *Tx) SeedReview(ctx context.Context, r *ReviewRow) error
- func (t *Tx) SeedReviewComment(ctx context.Context, c *ReviewCommentRow) error
- func (t *Tx) SeedUser(ctx context.Context, u *UserRow) error
- func (t *Tx) SubmitReview(ctx context.Context, pk int64, state, body, commitID string, ...) error
- func (t *Tx) TouchIssue(ctx context.Context, issuePK int64) error
- func (t *Tx) UpdateIssue(ctx context.Context, iss *IssueRow) error
- func (t *Tx) UpdatePullHead(ctx context.Context, pullPK int64, headSHA string) error
- func (t *Tx) UpdatePullMeta(ctx context.Context, pullPK int64, baseRef string, ...) error
- type UserRow
- type UserSearch
- type WebhookDeliveryRow
- type WebhookRow
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("store: not found")
ErrNotFound is returned when a row that was expected to exist does not.
var ErrOptimisticLock = errors.New("store: optimistic lock conflict")
ErrOptimisticLock signals that a row's version moved between read and write, so the caller should re-read and retry the edit.
var ReactionContents = []string{"+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"}
ReactionContents is the set of reaction names GitHub accepts, in the order its rollup reports them.
Functions ¶
func EncodeCursor ¶ added in v0.1.1
func EncodeCursor(c IssueCursor) string
EncodeCursor serializes the cursor to a URL-safe base64 string.
func EncodePullCursor ¶ added in v0.1.2
func EncodePullCursor(c PullCursor) string
EncodePullCursor serializes a pull cursor to a URL-safe base64 string.
Types ¶
type AuthCodeRow ¶ added in v0.1.3
type AuthCodeRow struct {
PK int64
CodeHash []byte
OAuthAppPK int64
UserPK int64
RedirectURI string
Scopes string
Used bool
ExpiresAt time.Time
CreatedAt time.Time
}
AuthCodeRow is a row of the oauth_auth_codes table. It backs the OAuth authorization-code grant (RFC 6749 §4.1). Each code is single-use and expires in 10 minutes. CodeHash is SHA-256(raw code).
type BranchProtectionRow ¶ added in v0.1.3
type BranchProtectionRow struct {
PK int64
RepoPK int64
BranchPattern string
RequirePRReviews bool
RequiredApprovingCount int
DismissStaleReviews bool
RequireCodeOwnerReviews bool
RequireStatusChecks bool
RequireBranchesUpToDate bool
StatusCheckContexts string // JSON array
EnforceAdmins bool
RestrictionsUsers string // JSON array
RestrictionsTeams string // JSON array
RestrictionsEnabled bool // a restrictions object was supplied at all
AllowForcePushes bool
AllowDeletions bool
RequiredLinearHistory bool
BlockCreations bool
RequiredConversationResolution bool
LockBranch bool
AllowForkSyncing bool
RequiredSignatures bool
CreatedAt time.Time
UpdatedAt time.Time
}
BranchProtectionRow is a row of the branch_protections table.
type CheckRunAnnotationRow ¶ added in v0.1.3
type CheckRunAnnotationRow struct {
PK int64
CheckRunPK int64
Path string
StartLine int64
EndLine int64
StartColumn *int64
EndColumn *int64
AnnotationLevel string
Message string
Title *string
RawDetails *string
CreatedAt time.Time
}
CheckRunAnnotationRow is a row of check_run_annotations, one line-anchored note a check run attaches to a file. Annotations append across updates.
type CheckRunRow ¶
type CheckRunRow struct {
PK int64
DBID int64
SuitePK int64
// SuiteDBID is the public id of the run's suite, read alongside the run so
// the response's check_suite reference matches GET /check-suites/{id}.
SuiteDBID int64
RepoPK int64
HeadSHA string
Name string
Status string
Conclusion *string
DetailsURL *string
ExternalID *string
OutputTitle *string
OutputSummary *string
OutputText *string
StartedAt *time.Time
CompletedAt *time.Time
// ActionsJSON is the requested actions block as the reporter sent it, a JSON
// array kept verbatim so the read path echoes what was written.
ActionsJSON *string
AnnotationsCount int64
CreatedAt time.Time
UpdatedAt time.Time
}
CheckRunRow is a row of check_runs, one named check against a head sha inside a suite. Status is queued, in_progress, or completed; Conclusion (success, failure, neutral, cancelled, timed_out, action_required, skipped) is set when the run completes.
type CheckSuiteRow ¶
type CheckSuiteRow struct {
PK int64
DBID int64
RepoPK int64
HeadSHA string
AppSlug string
Status string
Conclusion *string
CreatedAt time.Time
UpdatedAt time.Time
}
CheckSuiteRow is a row of check_suites, the per-app container for the check runs reported against a head sha. Status is queued, in_progress, or completed; Conclusion is set only once completed.
type CodeDoc ¶ added in v0.1.3
CodeDoc is one indexed file: its repository-relative path, the blob sha the content was read from, and the content itself. Content is empty for binary or oversized files, which are indexed by path only so an empty-term scoped query still lists them.
type CodeSearch ¶ added in v0.1.3
CodeSearch is a resolved code query: the repositories in scope (already visibility-checked by the domain) and the free-text terms. Empty Terms lists every indexed file in scope, the way an empty code query lists the tree.
type CollaboratorRow ¶ added in v0.1.3
CollaboratorRow is a row of the collaborators table.
type CommentRow ¶
type CommentRow struct {
PK int64
DBID int64
IssuePK int64
UserPK int64
Body string
CreatedAt time.Time
UpdatedAt time.Time
}
CommentRow is a row of the issue_comments table: a comment on an issue or pull request (both live in the issues table). Soft deletes keep the row so reaction and event history stays intact; reads skip deleted rows.
type CommitStatusRow ¶
type CommitStatusRow struct {
PK int64
DBID int64
RepoPK int64
SHA string
State string
Context string
TargetURL *string
Description *string
CreatorPK *int64
CreatedAt time.Time
UpdatedAt time.Time
}
CommitStatusRow is a row of commit_statuses, one external pass/fail report against a sha under a context. State is error, failure, pending, or success.
type DeviceCodeRow ¶
type DeviceCodeRow struct {
PK int64
DeviceCodeHash []byte
UserCode string
OAuthAppPK *int64
Scopes string
State string // pending | approved | denied
UserPK *int64
IntervalSec int
LastPolledAt *time.Time
ExpiresAt time.Time
CreatedAt time.Time
}
DeviceCodeRow is a row of the oauth_device_codes table backing the device flow state machine.
type Dialect ¶
type Dialect int
Dialect is the database backend in use. It is resolved once at Open from the DSN scheme and never changes for the life of a Store.
type EventFilter ¶
EventFilter selects a slice of the activity feed. RepoPK and ActorPK are the per-repository and per-user scopes; OwnerPK scopes to every repository a user or organization owns (the org timeline); PublicOnly applies the visibility filter the unauthenticated Events API enforces (the repo is public and the event is public). Limit caps the page.
type EventRow ¶
type EventRow struct {
PK int64
DBID int64
Event string
Action string
ActorPK int64
RepoPK int64
IssuePK *int64
Payload string
Public bool
CreatedAt time.Time
}
EventRow is a row of the events table: one append-only record of an action a user took on a repository. It feeds both the pull-based Events API and the push-based webhook fan-out. IssuePK is nullable because push and repository events have no issue. Public is the repo-visibility-derived flag the public Events API filters on; Payload is the rendered Events-API JSON document.
type GistCommentRow ¶ added in v0.1.3
type GistCommentRow struct {
PK int64
GistPK int64
UserPK int64
Body string
CreatedAt time.Time
UpdatedAt time.Time
}
GistCommentRow is a row of the gist_comments table.
type GistFileRow ¶ added in v0.1.3
GistFileRow is a row of the gist_files table.
type GistRow ¶ added in v0.1.3
type GistRow struct {
PK int64
GistID string
OwnerPK int64
Description string
Public bool
CreatedAt time.Time
UpdatedAt time.Time
Files []GistFileRow
}
GistRow is a row of the gists table, optionally including the file rows.
type GitHubAppRow ¶ added in v0.1.3
type GitHubAppRow struct {
PK int64
DBID int64
OwnerPK int64
Slug string
Name string
ClientID string
PrivateKeyPEM []byte
Permissions string // JSON object
Events string // JSON array
CreatedAt time.Time
}
GitHubAppRow is a row of the github_apps table.
type InstallationRow ¶ added in v0.1.3
type InstallationRow struct {
PK int64
DBID int64
AppPK int64
AccountPK int64
RepositorySelection string
Permissions string // JSON object
Events string // JSON array
SuspendedAt *time.Time
CreatedAt time.Time
}
InstallationRow is a row of the installations table.
type IssueCursor ¶ added in v0.1.1
IssueCursor is the opaque seek key for keyset-paginated issue lists. It encodes the (created_at, number) pair of the last item on the current page so the next page can be fetched with a single index seek rather than an OFFSET scan.
The cursor is an implementation detail of the store package; callers treat the encoded string as opaque and round-trip it unchanged.
func DecodeCursor ¶ added in v0.1.1
func DecodeCursor(s string) (IssueCursor, error)
DecodeCursor parses a cursor returned by EncodeCursor. Any malformed input returns an error; callers fall back to OFFSET when decoding fails.
type IssueEventRow ¶
type IssueEventRow struct {
PK int64
DBID int64
RepoPK int64
IssuePK int64
ActorPK *int64
Event string
Payload string
CreatedAt time.Time
}
IssueEventRow is a row of the issue_events timeline log.
type IssueFilter ¶
type IssueFilter struct {
State string // "open" | "closed" | "all"; "" means "open"
Labels []string // issue must carry every named label
CreatorPK *int64
AssigneePK *int64 // 0-valued pointer not used; nil means unfiltered
MilestonePK *int64
IncludePulls bool // when false, is_pull rows are excluded
Sort string // "created" | "updated" | "comments"; "" means "created"
Direction string // "asc" | "desc"; "" means "desc"
Limit int // 0 means the default page of 30
Offset int
// Cursor, when non-nil, switches the data query from OFFSET to a keyset
// seek: WHERE (created_at, number) < cursor. Only effective when Sort is
// "created" (or ""); ignored for other sort columns since the cursor encodes
// created_at. CountIssues always uses OFFSET so the total stays correct.
Cursor *IssueCursor
}
IssueFilter narrows a repository's issue list the way GitHub's list endpoint does. The zero value lists open issues, newest first, excluding pull requests. Empty slice/zero fields mean "do not filter on this".
type IssueRow ¶
type IssueRow struct {
PK int64
DBID int64
RepoPK int64
Number int64
IsPull bool
Title string
Body *string
UserPK int64
State string
StateReason *string
MilestonePK *int64
Locked bool
ActiveLockReason *string
CommentsCount int
ClosedAt *time.Time
ClosedByPK *int64
LockVersion int64
CreatedAt time.Time
UpdatedAt time.Time
}
IssueRow is a row of the issues table. The table is shared by issues and pull requests (IsPull tells them apart) since GitHub numbers them from one sequence per repository, but M4 only writes IsPull=false rows; the pull request milestone fills in the rest. StateReason carries GitHub's completed/reopened/not_planned qualifier and is nil for open issues that have never been closed.
type IssueSearch ¶
type IssueSearch struct {
ViewerPK int64
Terms []string
MatchTitle bool
MatchBody bool
IsPull *bool
State string // "", "open", "closed"
AuthorPK *int64
AssigneePK *int64
Labels []string
RepoPKs []int64
OwnerPKs []int64
MilestonePK *int64
Sort string // "created" | "updated" | "comments"; "" is created
Order string // "asc" | "desc"; "" is desc
Limit int
Offset int
}
IssueSearch is a resolved cross-repository issue query. The domain fills it from the parsed qualifiers: logins and repo names are already resolved to the internal pks here, so the store only filters. ViewerPK gates visibility: a row is returned only when its repository is public or owned by the viewer, so search never leaks a private repository. A nil pointer or empty slice means the corresponding filter is not applied; the term slice is ANDed, each term matched case-insensitively against the selected fields.
type JobRow ¶
type JobRow struct {
PK int64
Kind string
Payload string
DedupeKey string
State string
Attempts int
MaxAttempts int
}
JobRow is a row of the jobs table: one unit of background work. Payload is a JSON document the worker for that Kind decodes. DedupeKey, when non-empty, makes the job idempotent across a burst: while an identical key is queued or running, EnqueueJob skips the insert.
type LabelRow ¶
type LabelRow struct {
PK int64
DBID int64
RepoPK int64
Name string
Color string
Description *string
IsDefault bool
CreatedAt time.Time
UpdatedAt time.Time
}
LabelRow is a row of the labels table: a named, colored tag scoped to one repository. Color is stored as a six-hex string without the leading hash, the form GitHub's API returns. Description is nullable.
type MilestoneCount ¶ added in v0.1.3
type MilestoneCount struct{ Open, Closed int }
MilestoneCount holds the open and closed issue counts for one milestone.
type MilestoneRow ¶
type MilestoneRow struct {
PK int64
DBID int64
RepoPK int64
Number int64
Title string
Description *string
State string
DueOn *time.Time
CreatorPK *int64
ClosedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
MilestoneRow is a row of the milestones table. Milestones carry their own per-repo number, allocated from repositories.next_milestone_number, separate from the issue/PR number sequence. The open and closed issue counts GitHub reports are computed on read rather than cached, so they are not columns.
type NotificationThreadRow ¶ added in v0.1.3
type NotificationThreadRow struct {
PK int64
UserPK int64
RepoPK int64
IssuePK int64
Reason string
Unread bool
Subscribed bool
Ignored bool
LastReadAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
NotificationThreadRow is a row of the notification_threads table: one user's view of one issue or pull request conversation.
type OAuthAppRow ¶
type OAuthAppRow struct {
PK int64
ClientID string
ClientSecretHash []byte
Name string
OwnerPK *int64
DeviceFlowEnabled bool
CallbackURL string // registered authorization callback; "" means none registered
CreatedAt time.Time
}
OAuthAppRow is a row of the oauth_apps table.
type OrgMemberRow ¶ added in v0.1.3
OrgMemberRow is a row of the org_members table.
type ProfileUpdate ¶ added in v0.1.3
type ProfileUpdate struct {
Name *string
Email *string
Bio *string
Location *string
Company *string
Blog *string
TwitterUsername *string
Hireable *bool
}
ProfileUpdate carries the mutable profile fields the settings page can write. A nil pointer means "leave unchanged"; a non-nil pointer replaces the value.
type PullCheckStateRow ¶
type PullCheckStateRow struct {
PullPK int64
ReviewDecision *string
RollupState string
UpdatedAt time.Time
}
PullCheckStateRow is the denormalized snapshot the recompute worker writes: a pull request's derived review decision and status check rollup state, so list views and webhook payloads read one row instead of re-aggregating.
type PullCursor ¶ added in v0.1.2
type PullCursor struct {
Number int64
}
PullCursor is the opaque seek key for keyset-paginated pull-request lists. The list orders by per-repo number descending, which is unique within a repo, so the cursor needs only that number: the next page seeks number < cursor. The (repo_pk, number) unique index makes the seek a single index step regardless of page depth.
func DecodePullCursor ¶ added in v0.1.2
func DecodePullCursor(s string) (PullCursor, error)
DecodePullCursor parses a cursor returned by EncodePullCursor. Malformed input returns an error; callers fall back to OFFSET when decoding fails.
type PullFilter ¶ added in v0.1.3
type PullFilter struct {
State string
HeadOwner string
HeadRef string
BaseRef string
Sort string
Direction string
}
PullFilter narrows the pull list queries. State is "open", "closed", or "all" (the empty string lists open ones). HeadRef and BaseRef match the branch names on either end; HeadOwner additionally pins the head to a repository owned by that login, the "owner:branch" head form. Sort picks created (the default, served by the number index), updated, popularity (comment count), or long-running (creation age); Direction is asc or desc, defaulting to desc.
type PullRow ¶
type PullRow struct {
PK int64
DBID int64
IssuePK int64
RepoPK int64
BaseRef string
BaseSHA string
HeadRef string
HeadSHA string
HeadRepoPK *int64
Draft bool
MaintainerCanModify bool
Merged bool
MergedAt *time.Time
MergedByPK *int64
MergeCommitSHA *string
Mergeable *bool
MergeableState string
Rebaseable *bool
Additions int
Deletions int
ChangedFiles int
CommitsCount int
MergeabilityCheckedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
PullRow is a row of the pull_requests table, the extension a pull request carries on top of its issue row. IssuePK ties it to the issues row that holds the title, body, state, and per-repo number; the fields here are the git coordinates and the merge state. Mergeable and Rebaseable are pointers because they are NULL until the recompute_mergeability worker computes them, the null-then-value contract the API surfaces. HeadRepoPK, MergedAt, MergedByPK, MergeCommitSHA, and MergeabilityCheckedAt are nullable for the same reason a pull request acquires them only over its lifetime.
type ReactionRollup ¶
ReactionRollup is the per-content count GitHub embeds on reactable objects, plus the total.
type ReactionRow ¶
type ReactionRow struct {
PK int64
DBID int64
SubjectType string
SubjectPK int64
UserPK int64
Content string
CreatedAt time.Time
}
ReactionRow is a row of the reactions table. Reactions are polymorphic: a (SubjectType, SubjectPK) pair points at an issue, a comment, or later a review. Content is one of GitHub's eight reaction names (+1, -1, laugh, confused, heart, hooray, rocket, eyes).
type ReleaseAssetRow ¶ added in v0.1.3
type ReleaseAssetRow struct {
PK int64
DBID int64
ReleasePK int64
ReleaseDBID int64 // public id of the owning release, for asset urls
Name string
Label *string
ContentType string
Size int64
DownloadCount int64
UploaderPK *int64
State string
LockVersion int64
CreatedAt time.Time
UpdatedAt time.Time
}
ReleaseAssetRow is a row of the release_assets table.
type ReleaseRow ¶ added in v0.1.3
type ReleaseRow struct {
PK int64
DBID int64
RepoPK int64
TagName string
TargetCommitish string
Name *string
Body *string
Draft bool
Prerelease bool
AuthorPK *int64
LockVersion int64
CreatedAt time.Time
PublishedAt *time.Time
UpdatedAt time.Time
}
ReleaseRow is a row of the releases table.
type RepoPatch ¶ added in v0.1.3
type RepoPatch struct {
Name *string
Description *string
Homepage *string
DefaultBranch *string
Private *bool
HasIssues *bool
HasProjects *bool
HasWiki *bool
Archived *bool
IsTemplate *bool
AllowSquashMerge *bool
AllowMergeCommit *bool
AllowRebaseMerge *bool
AllowAutoMerge *bool
DeleteBranchOnMerge *bool
AllowUpdateBranch *bool
WebCommitSignoffRequired *bool
}
RepoPatch holds the nullable fields a PATCH /repos/{owner}/{repo} may update. A nil field means "leave as-is"; a non-nil field (even an empty string) is written. Name is separate because renaming a repo has extra consequences the caller handles (git path move, conflict check).
type RepoRow ¶
type RepoRow struct {
PK int64
DBID int64
OwnerPK int64
Name string
Description *string
Homepage *string
Private bool
Fork bool
DefaultBranch string
HasIssues bool
HasProjects bool
HasWiki bool
HasDownloads bool
Archived bool
Disabled bool
IsTemplate bool
OpenIssuesCount int
PushedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
Topics string // JSON array, e.g. '["go","api"]'
// The merge-policy settings 0023 adds: which merge methods pull requests
// may use plus the auto-merge, branch-cleanup, update-branch, and commit
// signoff switches.
AllowSquashMerge bool
AllowMergeCommit bool
AllowRebaseMerge bool
AllowAutoMerge bool
DeleteBranchOnMerge bool
AllowUpdateBranch bool
WebCommitSignoffRequired bool
// ForkOfPK links a fork to its parent repository's pk; nil for a
// repository that is not a fork (or whose parent was hard-deleted).
ForkOfPK *int64
}
RepoRow is a row of the repositories table, including the settings columns 0003 adds. OwnerPK is the internal pk of the owning user; the public owner object is resolved separately. Description and Homepage are nullable; the boolean flags carry GitHub's per-repository feature and state settings.
type RepoSearch ¶
type RepoSearch struct {
ViewerPK int64
Terms []string
OwnerPKs []int64
Fork *bool
Sort string // "updated" | "created"; "" is created
Order string // "asc" | "desc"; "" is desc
Limit int
Offset int
}
RepoSearch is a resolved cross-repository repository query. As with IssueSearch the domain resolves user:/org: to owner pks before building it, and ViewerPK gates visibility to public repositories and the viewer's own.
type ReviewCommentRow ¶
type ReviewCommentRow struct {
PK int64
DBID int64
ReviewPK int64
PullPK int64
RepoPK int64
UserPK int64
Path string
Side string
Line *int64
StartLine *int64
StartSide *string
OriginalLine *int64
OriginalStartLine *int64
Position *int64
OriginalPosition *int64
CommitID string
OriginalCommitID string
InReplyToPK *int64
DiffHunk string
SubjectType string
Body string
Resolved bool
ResolvedByPK *int64
CreatedAt time.Time
UpdatedAt time.Time
}
ReviewCommentRow is a row of pull_request_review_comments, a comment anchored to a diff line. Line/StartLine are file line numbers in the new model; Position is the legacy 1-based diff offset, kept for the older API shape. Side and StartSide are LEFT (base) or RIGHT (head). InReplyToPK threads a reply under the comment that started a conversation; Resolved marks that thread settled.
type ReviewRow ¶
type ReviewRow struct {
PK int64
DBID int64
PullPK int64
RepoPK int64
UserPK int64
State string
Body string
CommitID string
DismissedMessage *string
SubmittedAt *time.Time
CreatedAt time.Time
UpdatedAt time.Time
}
ReviewRow is a row of pull_request_reviews, one act of reviewing a pull request. State is PENDING (a draft with no submitted_at yet), APPROVED, CHANGES_REQUESTED, COMMENTED, or DISMISSED. SubmittedAt is nil while the review is still a pending draft. DismissedMessage carries the reason a review was later dismissed.
type SSHKeyRow ¶ added in v0.1.3
type SSHKeyRow struct {
PK int64
DBID int64
UserPK int64
Title *string
KeyType string
PublicKey string
Fingerprint string
ReadOnly bool
RepoPK *int64
LastUsedAt *time.Time
CreatedAt time.Time
}
SSHKeyRow is a row of the ssh_keys table. RepoPK is non-nil for deploy keys.
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store wraps the database pools together with the resolved dialect. It is safe for concurrent use; *sql.DB is a connection pool.
On SQLite the store holds two pools over the same file: db is the write pool, pinned to one connection so Go-side writers queue instead of fighting over the database write lock, and rdb is a multi-connection read pool. WAL mode exists precisely so N readers can run concurrently with the single writer; routing reads through rdb keeps a slow COUNT or search scan from head-of-line-blocking every other query. On Postgres both fields point at the same pool.
func Open ¶
Open resolves the dialect from the DSN, opens a pooled *sql.DB with the right driver, applies dialect-specific pool tuning, and verifies connectivity. pgPoolSize sets the Postgres max-open-connections limit; pass 0 (or use the default config value of 25) for the built-in default.
func (*Store) AddReviewRequests ¶ added in v0.1.3
AddReviewRequests links the given users as requested reviewers of the pull request, appending after the current positions and ignoring pairs that already exist.
func (*Store) AllocDBID ¶
AllocDBID returns the next value of the global ID sequence shared by every public resource (the REST `id` / GraphQL `databaseId`). On Postgres this draws from a SEQUENCE; on SQLite it bumps the single-row high-water allocator.
func (*Store) AssigneesByIssuePKs ¶ added in v0.1.1
func (s *Store) AssigneesByIssuePKs(ctx context.Context, issuePKs []int64) (map[int64][]int64, error)
AssigneesByIssuePKs loads all assignees for the given issue PKs in one query. Returns a map from issue_pk to the ordered slice of assignee user PKs.
func (*Store) BranchProtectionByPattern ¶ added in v0.1.3
func (s *Store) BranchProtectionByPattern(ctx context.Context, repoPK int64, pattern string) (*BranchProtectionRow, error)
BranchProtectionByPattern loads a branch protection rule for a specific pattern.
func (*Store) BulkLoad ¶ added in v0.1.2
BulkLoad runs fn with the store tuned for a one-time bulk load and restores the serving pragmas afterward. On SQLite it trades durability for speed during the load (synchronous=OFF, journal_mode=MEMORY): a crash mid-load can corrupt the database, which is acceptable because a seed is re-runnable against a clean target, and the gain is large because the load stops paying a per-commit fsync. On Postgres it is a passthrough; its bulk speed comes from the multi-row path, not session pragmas. The serving pragmas (WAL, synchronous=NORMAL) are restored even if fn fails.
func (*Store) BumpTokenLastUsed ¶
BumpTokenLastUsed records the last-used timestamp for a batch of tokens in one transaction. The async debouncer in auth coalesces touches and calls this at most once every couple of seconds, so the per-row UPDATE loop is cheap.
func (*Store) ClaimJob ¶
ClaimJob atomically takes the oldest runnable queued job, moving it to the running state and bumping its attempt count under the database's own clock so concurrent claimers never hand out the same job. It returns ErrNotFound when the queue holds nothing runnable. Postgres skips rows another transaction has locked; SQLite's single-writer transaction serializes claimers on its own.
func (*Store) CodeIndexHead ¶ added in v0.1.3
CodeIndexHead returns the head commit sha the repository's code documents were last built from, or ErrNotFound when the repository was never indexed.
func (*Store) CodeIndexTruncated ¶ added in v0.1.3
CodeIndexTruncated reports whether any of the repositories' indexes stopped at the file ceiling before covering the whole tree, which search surfaces as incomplete_results.
func (*Store) CollaboratorByRepo ¶ added in v0.1.3
func (s *Store) CollaboratorByRepo(ctx context.Context, repoPK, userPK int64) (*CollaboratorRow, error)
CollaboratorByRepo returns the permission for a user on a repo, or ErrNotFound.
func (*Store) CollaboratorsByRepo ¶ added in v0.1.3
CollaboratorsByRepo lists every collaborator grant on a repo, oldest grant first, the order the collaborators listing renders.
func (*Store) CommentsByIssuePKs ¶ added in v0.1.3
func (s *Store) CommentsByIssuePKs(ctx context.Context, issuePKs []int64, perIssue int) (map[int64][]CommentRow, error)
CommentsByIssuePKs returns the first perIssue comments of every listed issue in one query, chronological within each issue. It backs the GraphQL comment-preview dataloader: a 50-issue connection selecting a comment preview costs one window-function query instead of fifty list queries.
func (*Store) CompleteJob ¶
CompleteJob removes a finished job. A completed job leaves no trace; the dedupe key it held frees up immediately for the next enqueue.
func (*Store) ConsumeAuthCode ¶ added in v0.1.3
ConsumeAuthCode loads the auth code row by its hash and atomically marks it used. Returns ErrNotFound when no live, unused code matches the hash. The caller must verify redirect_uri and that ExpiresAt is still in the future.
func (*Store) CountForks ¶ added in v0.1.3
CountForks reports how many live repositories were forked from pk. It backs the network_count field on the full repository shape.
func (*Store) CountIssues ¶
CountIssues counts the issues matching the filter, ignoring its page window.
func (*Store) CountPulls ¶
CountPulls counts a repository's pull requests matching the filter.
func (*Store) CountSearchCode ¶ added in v0.1.3
CountSearchCode counts every indexed file matching the query, ignoring its page window, for the search envelope's total_count.
func (*Store) CountSearchIssues ¶
CountSearchIssues counts every issue matching the query, ignoring its page window, for the search envelope's total_count.
func (*Store) CountSearchRepositories ¶
CountSearchRepositories counts every repository matching the query for the envelope's total_count.
func (*Store) CountSearchUsers ¶ added in v0.1.3
CountSearchUsers counts every user matching the query for the envelope's total_count.
func (*Store) CountTeamMembers ¶ added in v0.1.3
CountTeamMembers returns how many users belong to a team.
func (*Store) CountTeamRepos ¶ added in v0.1.3
CountTeamRepos returns how many repositories a team has access to.
func (*Store) DB ¶
DB exposes the underlying pool. Reserved for the migration runner and tests; application code goes through typed Store methods.
func (*Store) DeleteBranchProtection ¶ added in v0.1.3
DeleteBranchProtection removes a branch protection rule.
func (*Store) DeleteCollaborator ¶ added in v0.1.3
DeleteCollaborator removes a collaborator from a repo.
func (*Store) DeleteComment ¶
DeleteComment soft deletes a comment and decrements its issue's cached count in one transaction so the count and the visible rows stay consistent.
func (*Store) DeleteDeviceCode ¶
DeleteDeviceCode removes a device-flow row once it is spent (token issued, denied, or expired).
func (*Store) DeleteFollow ¶ added in v0.1.3
DeleteFollow removes followerPK's follow of targetPK. Removing one that is absent is not an error.
func (*Store) DeleteGist ¶ added in v0.1.3
DeleteGist removes a gist and its files (cascaded by FK).
func (*Store) DeleteGistComment ¶ added in v0.1.3
DeleteGistComment removes a comment by its primary key.
func (*Store) DeleteLabel ¶
DeleteLabel removes a label; the issue_labels rows cascade.
func (*Store) DeleteMilestone ¶
DeleteMilestone removes a milestone; issues pointing at it have milestone_pk reset to NULL by the foreign key.
func (*Store) DeleteNotificationThread ¶ added in v0.1.3
DeleteNotificationThread removes a thread, the storage side of marking a notification done.
func (*Store) DeleteOrgMember ¶ added in v0.1.3
DeleteOrgMember removes a user from an org.
func (*Store) DeleteReaction ¶
func (s *Store) DeleteReaction(ctx context.Context, subjectType string, subjectPK, dbID int64) error
DeleteReaction removes a reaction by its public database id, scoped to its subject so a caller cannot delete a reaction belonging to another object.
func (*Store) DeleteRelease ¶ added in v0.1.3
DeleteRelease soft-deletes a release row.
func (*Store) DeleteReleaseAsset ¶ added in v0.1.3
DeleteReleaseAsset soft-deletes a release asset.
func (*Store) DeleteReview ¶ added in v0.1.3
DeleteReview hard-deletes a pending review by primary key. Only pending (PENDING state) reviews may be deleted; submitted reviews are immutable.
func (*Store) DeleteReviewComment ¶ added in v0.1.3
DeleteReviewComment removes an inline comment by primary key.
func (*Store) DeleteSSHKey ¶ added in v0.1.3
DeleteSSHKey deletes an SSH key by primary key.
func (*Store) DeleteStar ¶ added in v0.1.3
DeleteStar removes userPK's star on repoPK. Removing a star that is not there is not an error, matching the idempotent DELETE.
func (*Store) DeleteSubscription ¶ added in v0.1.3
DeleteSubscription removes userPK's subscription on repoPK. Removing one that is absent is not an error.
func (*Store) DeleteTeam ¶ added in v0.1.3
DeleteTeam removes a team.
func (*Store) DeleteTeamMember ¶ added in v0.1.3
DeleteTeamMember removes a user from a team.
func (*Store) DeleteTeamRepo ¶ added in v0.1.3
DeleteTeamRepo removes a repo from a team.
func (*Store) DeleteUserToken ¶ added in v0.1.3
DeleteUserToken removes one of a user's personal access tokens. The user_pk guard means a user can only ever delete their own token; deleting someone else's pk is the same ErrNotFound as deleting a pk that never existed.
func (*Store) DeleteWebhook ¶
DeleteWebhook removes a webhook by its public id and, by cascade, its deliveries.
func (*Store) DeployKeysByRepo ¶ added in v0.1.3
DeployKeysByRepo returns all deploy keys for a repository.
func (*Store) DeviceCodeByHash ¶
DeviceCodeByHash loads a device-flow row by sha256(device_code), the lookup the polling endpoint uses.
func (*Store) DeviceCodeByUserCode ¶
DeviceCodeByUserCode loads a device-flow row by the human-typed user_code.
func (*Store) DismissReview ¶
DismissReview marks a submitted review dismissed with a reason, dropping its approval or change request from the decision without deleting its comments.
func (*Store) EnqueueJob ¶
EnqueueJob inserts a queued job and fills the server-assigned fields back onto j. When DedupeKey is non-empty and an active (queued or running) job already carries that key, the insert is skipped and deduped is true, so a flurry of pushes to one pull request collapses into a single recompute. The partial unique index backstops a race between two concurrent enqueues.
func (*Store) EnsureCheckSuite ¶
func (s *Store) EnsureCheckSuite(ctx context.Context, repoPK int64, headSHA, appSlug string) (*CheckSuiteRow, error)
EnsureCheckSuite returns the suite for (repo, head_sha, app), creating it on first report. The unique key makes the create idempotent under the same head.
func (*Store) FailJob ¶
func (s *Store) FailJob(ctx context.Context, pk int64, attempts, maxAttempts int, reason string, backoffSeconds int) error
FailJob records a handler failure. While attempts remain it requeues the job for a later retry after backoffSeconds, computed on the database clock so the run_after stays in the column's native format. Once the attempts are spent it parks the job in the dead state far in the future, kept for inspection rather than deleted.
func (*Store) FollowerCount ¶ added in v0.1.3
FollowerCount reports how many users follow targetPK.
func (*Store) FollowersByUser ¶ added in v0.1.3
func (s *Store) FollowersByUser(ctx context.Context, targetPK int64, limit, offset int) ([]*UserRow, error)
FollowersByUser lists the users following targetPK, most recent follow first, paged by limit and offset.
func (*Store) FollowingByUser ¶ added in v0.1.3
func (s *Store) FollowingByUser(ctx context.Context, followerPK int64, limit, offset int) ([]*UserRow, error)
FollowingByUser lists the users followerPK follows, most recent follow first, paged by limit and offset.
func (*Store) FollowingCount ¶ added in v0.1.3
FollowingCount reports how many users followerPK follows.
func (*Store) ForksOf ¶ added in v0.1.3
ForksOf lists the live forks of pk, newest first, which is the order the repository forks endpoint serves by default.
func (*Store) GetCheckRun ¶
GetCheckRun resolves a check run by its public database id.
func (*Store) GetCheckSuiteByDBID ¶ added in v0.1.3
GetCheckSuiteByDBID resolves a check suite by its public database id, the lookup GET /repos/{owner}/{repo}/check-suites/{id} performs.
func (*Store) GetComment ¶
GetComment resolves a single comment by its public database id.
func (*Store) GetCommentByPK ¶
GetCommentByPK resolves a single comment by primary key.
func (*Store) GetDeliveryByPK ¶
GetDeliveryByPK resolves one delivery by primary key, the value a redeliver job carries so the worker can replay the recorded request.
func (*Store) GetDeliveryForWebhook ¶
func (s *Store) GetDeliveryForWebhook(ctx context.Context, webhookPK, dbID int64) (*WebhookDeliveryRow, error)
GetDeliveryForWebhook resolves one delivery by its public id scoped to its webhook, the lookup the inspect and redeliver endpoints use.
func (*Store) GetEventByPK ¶
GetEventByPK resolves one event by primary key, the value a deliver_event job carries so the fan-out worker can render and store its payload.
func (*Store) GetGistByID ¶ added in v0.1.3
GetGistByID fetches a gist and its files by its hex gist_id.
func (*Store) GetGistComment ¶ added in v0.1.3
GetGistComment returns one comment by its primary key.
func (*Store) GetIssueByDBID ¶
GetIssueByDBID resolves an issue by its public database id.
func (*Store) GetIssueByNumber ¶
GetIssueByNumber resolves an issue by its per-repo number, skipping soft deleted rows.
func (*Store) GetIssueByPK ¶
GetIssueByPK resolves an issue by primary key.
func (*Store) GetLabel ¶
GetLabel resolves a single label by name within a repository, case-insensitively, matching GitHub's case-preserving but case-insensitive label names.
func (*Store) GetLabelByDBID ¶ added in v0.1.3
GetLabelByDBID resolves a single label by its public database id.
func (*Store) GetLatestRelease ¶ added in v0.1.3
GetLatestRelease returns the most recent non-draft, non-prerelease release ordered by published_at descending.
func (*Store) GetMilestoneByDBID ¶ added in v0.1.3
GetMilestoneByDBID resolves a milestone by its public database id, the id a milestone node id encodes.
func (*Store) GetMilestoneByNumber ¶
func (s *Store) GetMilestoneByNumber(ctx context.Context, repoPK, number int64) (*MilestoneRow, error)
GetMilestoneByNumber resolves a milestone by its per-repo number.
func (*Store) GetMilestoneByPK ¶
GetMilestoneByPK resolves a milestone by primary key.
func (*Store) GetPullByDBID ¶
GetPullByDBID resolves a pull request by its public database id, the value a PullRequest node id decodes to.
func (*Store) GetPullByIssuePK ¶
GetPullByIssuePK resolves the pull request extension of an issue row.
func (*Store) GetPullCheckState ¶
GetPullCheckState returns a pull request's cached review decision and rollup snapshot, or ErrNotFound before the recompute worker has written one.
func (*Store) GetReleaseAssetByID ¶ added in v0.1.3
GetReleaseAssetByID loads a release asset by its public database id.
func (*Store) GetReleaseByID ¶ added in v0.1.3
GetReleaseByID loads a release by its public database id within a repo.
func (*Store) GetReleaseByPK ¶ added in v0.1.3
GetReleaseByPK loads a release by its internal pk, the lookup the webhook renderer resolves a recorded release event through.
func (*Store) GetReleaseByTag ¶ added in v0.1.3
GetReleaseByTag loads a release by its tag name within a repository.
func (*Store) GetReviewByDBID ¶
GetReviewByDBID resolves a review by its public database id, the value a PullRequestReview node id decodes to.
func (*Store) GetReviewByPK ¶
GetReviewByPK resolves a review by primary key.
func (*Store) GetReviewComment ¶
GetReviewComment resolves an inline comment by its public database id.
func (*Store) GetReviewCommentByPK ¶
GetReviewCommentByPK resolves an inline comment by primary key.
func (*Store) GetWebhookByPK ¶
GetWebhookByPK resolves a webhook by primary key.
func (*Store) GetWebhookForRepo ¶
GetWebhookForRepo resolves a webhook by its public id scoped to its repository, the lookup the REST CRUD endpoints use so a hook id from one repository never addresses another's.
func (*Store) GitHubAppByClientID ¶ added in v0.1.3
GitHubAppByClientID loads a GitHub App by its OAuth client_id.
func (*Store) GitHubAppByPK ¶ added in v0.1.3
GitHubAppByPK loads a GitHub App by its internal primary key.
func (*Store) IncrementAssetDownloadCount ¶ added in v0.1.3
IncrementAssetDownloadCount bumps the download counter for an asset.
func (*Store) InsertAuthCode ¶ added in v0.1.3
func (s *Store) InsertAuthCode(ctx context.Context, a *AuthCodeRow) error
InsertAuthCode stores a new OAuth authorization-code row. The caller hashes the raw code before passing it in.
func (*Store) InsertCheckRun ¶
func (s *Store) InsertCheckRun(ctx context.Context, r *CheckRunRow) error
InsertCheckRun writes a check run with a freshly allocated db_id.
func (*Store) InsertCheckRunAnnotations ¶ added in v0.1.3
func (s *Store) InsertCheckRunAnnotations(ctx context.Context, checkRunPK int64, anns []CheckRunAnnotationRow) error
InsertCheckRunAnnotations appends a batch of annotations to a check run and refreshes the run's denormalized count, all inside one transaction. Annotations accumulate across updates; GitHub never replaces earlier ones.
func (*Store) InsertComment ¶
func (s *Store) InsertComment(ctx context.Context, c *CommentRow) error
InsertComment writes a comment and bumps the issue's cached comment count in one transaction, filling the server-assigned fields back onto c.
func (*Store) InsertCommitStatus ¶
func (s *Store) InsertCommitStatus(ctx context.Context, st *CommitStatusRow) error
InsertCommitStatus appends a status report for a sha under a context. Each report is its own row; the latest per context wins when combining, matching GitHub's append-and-supersede model.
func (*Store) InsertDelivery ¶
func (s *Store) InsertDelivery(ctx context.Context, d *WebhookDeliveryRow) error
InsertDelivery records the result of one POST with a freshly allocated db_id, filling the server-assigned fields back onto d.
func (*Store) InsertDeviceCode ¶
func (s *Store) InsertDeviceCode(ctx context.Context, d *DeviceCodeRow) error
InsertDeviceCode opens a new device-flow row in the pending state.
func (*Store) InsertEvent ¶
InsertEvent appends one event row with a freshly allocated db_id, filling the server-assigned fields back onto e. It opens its own transaction because the caller records the event after its own mutation has committed.
func (*Store) InsertEventAndJob ¶ added in v0.1.1
func (s *Store) InsertEventAndJob(ctx context.Context, e *EventRow, jobKind string, buildPayload func(eventPK int64) string) error
InsertEventAndJob appends an event row and enqueues a background job in one transaction, halving the write-transaction count for a triggered write (the three-transaction sequence of mutation / event / job becomes two). buildPayload is called after the event INSERT so it can embed the event's assigned PK; the job uses no dedupe key. On failure the event and job both roll back together.
func (*Store) InsertFollow ¶ added in v0.1.3
InsertFollow records that followerPK follows targetPK. A follow already present is left as-is, so a repeated PUT is idempotent.
func (*Store) InsertGist ¶ added in v0.1.3
InsertGist stores a new gist with its files. It sets PK, CreatedAt, and UpdatedAt on g; each file's PK and GistPK are set on success.
func (*Store) InsertGistComment ¶ added in v0.1.3
func (s *Store) InsertGistComment(ctx context.Context, c *GistCommentRow) error
InsertGistComment adds a comment to a gist.
func (*Store) InsertGitHubApp ¶ added in v0.1.3
func (s *Store) InsertGitHubApp(ctx context.Context, a *GitHubAppRow) error
InsertGitHubApp registers a GitHub App. The installer seeds the first-party app this way; tests use it to set up the app-auth surface. A zero Permissions or Events string defaults to the empty JSON object/array the columns require.
func (*Store) InsertInstallation ¶ added in v0.1.3
func (s *Store) InsertInstallation(ctx context.Context, in *InstallationRow) error
InsertInstallation records an app installation on an account.
func (*Store) InsertInstallationRepo ¶ added in v0.1.3
InsertInstallationRepo grants a "selected"-scope installation access to a repository.
func (*Store) InsertLabel ¶
InsertLabel writes a label and fills the server-assigned fields back onto l.
func (*Store) InsertMilestone ¶
func (s *Store) InsertMilestone(ctx context.Context, m *MilestoneRow) error
InsertMilestone allocates the per-repo milestone number and the global db_id in one transaction with the row insert.
func (*Store) InsertOAuthApp ¶
func (s *Store) InsertOAuthApp(ctx context.Context, a *OAuthAppRow) error
InsertOAuthApp registers an OAuth/GitHub-App client. The installer seeds the first-party gh client this way; tests use it to set up a device-flow app.
func (*Store) InsertReaction ¶
InsertReaction adds a reaction, returning created=false when the user already reacted with that content on that subject (GitHub responds 200 with the existing reaction rather than creating a duplicate). The unique index backstops a race.
func (*Store) InsertRelease ¶ added in v0.1.3
func (s *Store) InsertRelease(ctx context.Context, r *ReleaseRow) error
InsertRelease allocates a db_id and writes the row, filling server-assigned fields back onto r.
func (*Store) InsertReleaseAsset ¶ added in v0.1.3
func (s *Store) InsertReleaseAsset(ctx context.Context, a *ReleaseAssetRow) error
InsertReleaseAsset allocates a db_id and writes the row.
func (*Store) InsertRepo ¶
InsertRepo allocates the shared db_id, writes the row, and fills the server-assigned fields back onto r. The feature and state flags are left to their column defaults (GitHub turns issues, projects, wiki, and downloads on at creation; archived, disabled, and is_template start off) and read back via RETURNING, so a freshly inserted RepoRow reflects exactly what is stored. A repository-settings update path arrives with its milestone.
func (*Store) InsertSSHKey ¶ added in v0.1.3
InsertSSHKey inserts a new SSH key and fills PK, DBID, and CreatedAt back onto k.
func (*Store) InsertStar ¶ added in v0.1.3
InsertStar records that userPK starred repoPK. A star already present is left as-is, so a repeated PUT is idempotent the way GitHub's is.
func (*Store) InsertTeam ¶ added in v0.1.3
InsertTeam inserts a new team and fills PK, DBID, CreatedAt, UpdatedAt back onto t.
func (*Store) InsertToken ¶
InsertToken writes a new credential and fills PK and CreatedAt back onto t.
func (*Store) InsertUser ¶
InsertUser allocates the shared db_id, writes the row, and fills the server-assigned fields (PK, DBID, CreatedAt, UpdatedAt) back onto u.
func (*Store) InsertUserWithPassword ¶ added in v0.1.3
func (s *Store) InsertUserWithPassword(ctx context.Context, login, email, hash string) (int64, error)
InsertUserWithPassword creates a new user account with the given login, email, and bcrypt password hash in one transaction. It returns the new user's PK. Used by the web sign-up flow; fe/web/auth calls it through the PasswordStore interface so it never imports store directly.
func (*Store) InsertWebhook ¶
func (s *Store) InsertWebhook(ctx context.Context, w *WebhookRow) error
InsertWebhook writes a webhook row with a freshly allocated db_id, filling the server-assigned fields back onto w.
func (*Store) Install ¶ added in v0.1.2
Install provisions a fresh database from the consolidated schema file rather than replaying the incremental migrations one by one. It applies schema.<dialect>.sql in a single transaction, then stamps schema_migrations with every known version and its checksum so a subsequent Migrate sees the database as fully up to date and does nothing.
Install refuses to run on a database that already carries applied migrations: it is a fresh-install fast path, not a substitute for Migrate on an existing database. Callers that are unsure should call Migrate, which is always safe.
func (*Store) InstallationByAppAndAccount ¶ added in v0.1.3
func (s *Store) InstallationByAppAndAccount(ctx context.Context, appPK, accountPK int64) (*InstallationRow, error)
InstallationByAppAndAccount loads the installation of app appPK on the account accountPK, the lookup GET /repos/{owner}/{repo}/installation needs to resolve a repository's owning account back to its installation.
func (*Store) InstallationByDBID ¶ added in v0.1.3
InstallationByDBID loads an installation by its public database id, the id the installation object and its access_tokens_url expose to API clients.
func (*Store) InstallationByPK ¶ added in v0.1.3
InstallationByPK loads an installation by its internal primary key.
func (*Store) InstallationRepoPKs ¶ added in v0.1.3
InstallationRepoPKs returns the repo PKs accessible to an installation.
func (*Store) InstallationsByAppPK ¶ added in v0.1.3
InstallationsByAppPK returns all installations for an app, ordered by created_at.
func (*Store) IsAssigned ¶
IsAssigned reports whether a user is currently assigned to an issue.
func (*Store) IsFollowing ¶ added in v0.1.3
IsFollowing reports whether followerPK follows targetPK.
func (*Store) IsGistStarred ¶ added in v0.1.3
IsGistStarred reports whether userPK has starred gistPK.
func (*Store) IssueListVersion ¶ added in v0.1.3
func (s *Store) IssueListVersion(ctx context.Context, repoPK int64, f IssueFilter) (int, string, error)
IssueListVersion returns the count and the latest updated_at marker of the issues matching the filter, ignoring its page window. The pair is the cheap version seed the REST list handler hashes into an ETag: every write that changes a list body also bumps an issue's updated_at or the count, so an If-None-Match hit answers from this one aggregate instead of fetching, assembling, and marshaling the page. The marker is returned as the column's raw text; callers hash it, they never parse it.
func (*Store) IssuesByPKs ¶ added in v0.1.1
IssuesByPKs loads issues by primary key in one round trip. PKs with no live row are silently absent from the returned map.
func (*Store) LabelsByIssue ¶
LabelsByIssue returns the labels attached to one issue, in name order.
func (*Store) LabelsByIssuePKs ¶ added in v0.1.1
func (s *Store) LabelsByIssuePKs(ctx context.Context, issuePKs []int64) (map[int64][]LabelRow, error)
LabelsByIssuePKs loads all labels for the given issue PKs in one query. Returns a map from issue_pk to the ordered slice of labels for that issue.
func (*Store) LabelsByNames ¶
func (s *Store) LabelsByNames(ctx context.Context, repoPK int64, names []string) ([]LabelRow, error)
LabelsByNames resolves the named labels within a repository, skipping any that do not exist. The result preserves the order the names were given so the caller can render labels in request order.
func (*Store) ListActiveWebhooks ¶
ListActiveWebhooks returns a repository's active webhooks, the candidate set the fan-out worker filters by subscribed event.
func (*Store) ListAllReviewComments ¶ added in v0.1.3
func (s *Store) ListAllReviewComments(ctx context.Context, repoPK int64) ([]ReviewCommentRow, error)
ListAllReviewComments returns all inline comments in a repository, oldest first.
func (*Store) ListAssigneePKs ¶
ListAssigneePKs returns the user primary keys assigned to an issue, in the order they were assigned (the position column). The presenter resolves these to user rows; keeping the join read here avoids loading whole user rows when a caller only needs the set.
func (*Store) ListCheckRunAnnotations ¶ added in v0.1.3
func (s *Store) ListCheckRunAnnotations(ctx context.Context, checkRunPK int64) ([]CheckRunAnnotationRow, error)
ListCheckRunAnnotations returns a check run's annotations in insertion order, the body of the annotations endpoint.
func (*Store) ListCheckRunsForRef ¶
func (s *Store) ListCheckRunsForRef(ctx context.Context, repoPK int64, headSHA string) ([]CheckRunRow, error)
ListCheckRunsForRef returns every check run reported against a head sha, the list the rollup folds and the check-runs endpoint pages.
func (*Store) ListCheckRunsForSuite ¶
ListCheckRunsForSuite returns the runs inside one suite.
func (*Store) ListCheckRunsForSuites ¶ added in v0.1.1
func (s *Store) ListCheckRunsForSuites(ctx context.Context, suitePKs []int64) (map[int64][]CheckRunRow, error)
ListCheckRunsForSuites loads all check runs for any of the given suite PKs in one query. Returns a map from suite_pk to its ordered slice of check runs.
func (*Store) ListCheckSuites ¶
func (s *Store) ListCheckSuites(ctx context.Context, repoPK int64, headSHA string) ([]CheckSuiteRow, error)
ListCheckSuites returns every suite reported against a head sha.
func (*Store) ListCommitStatuses ¶
func (s *Store) ListCommitStatuses(ctx context.Context, repoPK int64, sha string) ([]CommitStatusRow, error)
ListCommitStatuses returns every status reported for a sha, newest first, the raw list the statuses endpoint pages and the combined-state algorithm folds.
func (*Store) ListDeliveries ¶
func (s *Store) ListDeliveries(ctx context.Context, webhookPK int64, limit int) ([]WebhookDeliveryRow, error)
ListDeliveries returns a webhook's recent deliveries, newest first.
func (*Store) ListEvents ¶
ListEvents returns the activity feed matching f, newest first. It joins the owning repository so the public filter reads the live visibility rather than only the flag frozen on the event at insert time.
func (*Store) ListGistComments ¶ added in v0.1.3
ListGistComments returns all comments for a gist.
func (*Store) ListGistsByOwner ¶ added in v0.1.3
func (s *Store) ListGistsByOwner(ctx context.Context, ownerPK int64, page, perPage int) ([]*GistRow, int, error)
ListGistsByOwner returns up to perPage gists owned by ownerPK, offset by page.
func (*Store) ListIssueComments ¶
func (s *Store) ListIssueComments(ctx context.Context, issuePK int64, limit, offset int) ([]CommentRow, error)
ListIssueComments returns an issue's comments in chronological order, one page at a time. A limit of zero returns the default page of 30.
func (*Store) ListIssueCommentsAfter ¶ added in v0.1.3
func (s *Store) ListIssueCommentsAfter(ctx context.Context, issuePK int64, createdAt time.Time, afterPK int64, limit int) ([]CommentRow, error)
ListIssueCommentsAfter returns the comments after the (createdAt, pk) seek key in the same chronological (created_at, pk) order ListIssueComments pages over, so a cursor walk costs a single index range scan per page regardless of how deep into the thread it is. The caller recovers the seek pair from the comment the cursor names.
func (*Store) ListIssueEvents ¶
ListIssueEvents returns an issue's timeline in chronological order.
func (*Store) ListIssues ¶
ListIssues returns a repository's issues matching the filter, one page at a time. When the filter carries a Cursor and the sort is "created" (default), the query is a keyset seek instead of OFFSET, so deep pages are O(1) in page depth rather than O(page*per_page).
func (*Store) ListIssuesPage ¶ added in v0.1.2
func (s *Store) ListIssuesPage(ctx context.Context, repoPK int64, f IssueFilter) ([]IssueRow, bool, error)
ListIssuesPage serves a keyset-paginated issue page and reports whether a further page exists, without a COUNT. It fetches one row beyond the page and uses its presence as the has-next signal, so a list request on a several-hundred-thousand-issue repo costs the page, not a full count plus a deep OFFSET scan. The filter must be keysetEligible; callers check that the cursor decoded before routing here.
func (*Store) ListJobs ¶
ListJobs returns every job ordered by primary key. It backs tests and the worker's startup recovery scan; the per-kind claim path lands with the worker milestone.
func (*Store) ListLabels ¶
ListLabels returns a repository's labels in name order.
func (*Store) ListMilestones ¶
func (s *Store) ListMilestones(ctx context.Context, repoPK int64, state string) ([]MilestoneRow, error)
ListMilestones returns a repository's milestones filtered by state ("open"|"closed"|"all"), ordered by number.
func (*Store) ListNotificationThreads ¶ added in v0.1.3
func (s *Store) ListNotificationThreads(ctx context.Context, userPK, repoPK int64, all bool, limit, offset int) ([]*NotificationThreadRow, int, error)
ListNotificationThreads returns one page of a user's threads, most recently updated first, with the total for the same filter. A zero repoPK spans all repositories; all=false keeps only unread threads, GitHub's default view.
func (*Store) ListPublicGists ¶ added in v0.1.3
ListPublicGists returns the most recently updated public gists.
func (*Store) ListPublicRepos ¶ added in v0.1.3
func (s *Store) ListPublicRepos(ctx context.Context, sinceDBID int64, limit int) ([]*RepoRow, error)
ListPublicRepos returns live public repositories ordered by ascending db_id after sinceDBID, capped at limit. It backs the global GET /repositories listing, which walks every public repository by id the way GitHub's id-cursor endpoint does, so a sinceDBID of zero starts from the first repo.
func (*Store) ListPulls ¶
func (s *Store) ListPulls(ctx context.Context, repoPK int64, f PullFilter, limit, offset int) ([]PullRow, error)
ListPulls returns a repository's pull requests matching the filter, paged. It joins the issues table so the state filter and the orderings read from the row that owns them. The repository filter goes on i.repo_pk (identical to pr.repo_pk by construction): that way the issues (repo_pk, number) unique index serves both the filter and the default ORDER BY, with no sort step.
func (*Store) ListPullsPage ¶ added in v0.1.2
func (s *Store) ListPullsPage(ctx context.Context, repoPK int64, f PullFilter, cursor *PullCursor, limit int) ([]PullRow, bool, error)
ListPullsPage serves a keyset-paginated pull-request page and reports whether a further page exists, without a COUNT. The list orders by number descending, so a cursor seeks number < cursor.Number, served by the issues (repo_pk, number) unique index in one step regardless of page depth; the repository filter sits on i.repo_pk so the planner can use that index. It fetches one row beyond the page and uses its presence as the has-next signal, so a list request on a repo with hundreds of thousands of pulls costs the page, not a full count plus a deep OFFSET scan. A nil cursor starts from the highest number. The filter's Sort and Direction are ignored: the seek key is the number order, and the handler only routes default-ordered walks here.
func (*Store) ListReactions ¶
func (s *Store) ListReactions(ctx context.Context, subjectType string, subjectPK int64) ([]ReactionRow, error)
ListReactions returns every reaction on a subject, oldest first.
func (*Store) ListReleaseAssets ¶ added in v0.1.3
ListReleaseAssets returns all non-deleted assets for a release.
func (*Store) ListReleases ¶ added in v0.1.3
func (s *Store) ListReleases(ctx context.Context, repoPK int64, includeDrafts bool, limit, offset int) ([]ReleaseRow, error)
ListReleases returns a page of releases for a repository, newest first. When includeDrafts is false, draft rows are excluded.
func (*Store) ListReviewComments ¶
ListReviewComments returns every inline comment on a pull request, oldest first, the set the thread grouping in the GraphQL layer folds into threads.
func (*Store) ListReviewCommentsForReview ¶
func (s *Store) ListReviewCommentsForReview(ctx context.Context, reviewPK int64) ([]ReviewCommentRow, error)
ListReviewCommentsForReview returns the inline comments a single review owns.
func (*Store) ListReviewRequestPKs ¶ added in v0.1.3
ListReviewRequestPKs returns the user primary keys requested to review a pull request, in request order.
func (*Store) ListReviews ¶
ListReviews returns a pull request's submitted reviews in chronological order. Pending drafts are excluded: they are private to their author until submitted.
func (*Store) ListStarredGists ¶ added in v0.1.3
func (s *Store) ListStarredGists(ctx context.Context, userPK int64, page, perPage int) ([]*GistRow, int, error)
ListStarredGists returns gists starred by userPK.
func (*Store) ListUsers ¶ added in v0.1.3
ListUsers returns up to limit live users with db_id greater than sinceDBID, ordered by db_id, matching GitHub's id-cursor GET /users. A sinceDBID of 0 starts from the first user.
func (*Store) ListWebhooks ¶
ListWebhooks returns a repository's webhooks, oldest first.
func (*Store) MarkNotificationThreadRead ¶ added in v0.1.3
MarkNotificationThreadRead marks one thread read and stamps last_read_at.
func (*Store) MarkNotificationThreadsRead ¶ added in v0.1.3
MarkNotificationThreadsRead marks all of a user's threads read, optionally scoped to one repository (zero repoPK spans all).
func (*Store) Migrate ¶
Migrate applies every pending up migration in version order. It is safe to run on every boot: already-applied migrations are skipped, and a checksum mismatch on a previously-applied version is reported rather than silently re-run.
func (*Store) MilestoneIssueCounts ¶
func (s *Store) MilestoneIssueCounts(ctx context.Context, milestonePK int64) (open, closed int, err error)
MilestoneIssueCounts returns the open and closed issue counts for a milestone, computed from the issues that point at it.
func (*Store) MilestoneIssueCountsByPKs ¶ added in v0.1.3
func (s *Store) MilestoneIssueCountsByPKs(ctx context.Context, pks []int64) (map[int64]MilestoneCount, error)
MilestoneIssueCountsByPKs loads open and closed issue counts for multiple milestones in one query. PKs absent from the result have zero counts.
func (*Store) MilestonesByPKs ¶ added in v0.1.1
MilestonesByPKs loads milestones by primary key in one round trip. PKs with no matching row are silently absent from the returned map.
func (*Store) NotificationThreadByPK ¶ added in v0.1.3
func (s *Store) NotificationThreadByPK(ctx context.Context, pk int64) (*NotificationThreadRow, error)
NotificationThreadByPK loads a single thread.
func (*Store) OAuthAppByClientID ¶
OAuthAppByClientID loads an OAuth app by its public client_id.
func (*Store) OpenPullsByBaseRef ¶
func (s *Store) OpenPullsByBaseRef(ctx context.Context, repoPK int64, baseRef string) ([]PullRow, error)
OpenPullsByBaseRef returns the open pull requests in a repository that target the given base branch, the set whose behind count and mergeability the post-receive sink re-checks when that branch moves.
func (*Store) OpenPullsByHeadRef ¶
func (s *Store) OpenPullsByHeadRef(ctx context.Context, repoPK int64, headRef string) ([]PullRow, error)
OpenPullsByHeadRef returns the open pull requests in a repository whose head branch is the given short ref name, the set the post-receive sink refreshes and re-checks when that branch moves.
func (*Store) OpenPullsByHeadSHA ¶
func (s *Store) OpenPullsByHeadSHA(ctx context.Context, repoPK int64, headSHA string) ([]PullRow, error)
OpenPullsByHeadSHA returns the open pull requests in a repository whose head currently points at the given sha, the set a status or check report against that sha refreshes the rollup of.
func (*Store) OrgMemberRole ¶ added in v0.1.3
OrgMemberRole returns the role of a user in an org, or ErrNotFound.
func (*Store) OrgMembersByOrg ¶ added in v0.1.3
OrgMembersByOrg lists an org's membership rows, oldest first.
func (*Store) OrgMembersByUser ¶ added in v0.1.3
OrgMembersByUser lists a user's org memberships, oldest first. The OrgPK field of each row names the org the user belongs to.
func (*Store) PasswordHashFor ¶ added in v0.1.3
func (s *Store) PasswordHashFor(ctx context.Context, login string) (pk int64, hash string, err error)
PasswordHashFor returns the stored bcrypt hash for the given login, or ("", ErrNotFound) when the user does not exist. The caller compares it with bcrypt.CompareHashAndPassword.
func (*Store) PendingReviewFor ¶
PendingReviewFor returns the user's open pending review on a pull request, or ErrNotFound when they hold none. It enforces the one-pending-draft rule the service checks before opening a new draft.
func (*Store) PruneDeliveries ¶ added in v0.1.3
PruneDeliveries deletes delivery records created before the cutoff and returns how many went. Every record carries the full request and response bodies, so the table grows without bound unless something sweeps it; the worker's retention loop calls this on a timer.
func (*Store) PullListVersion ¶ added in v0.1.3
func (s *Store) PullListVersion(ctx context.Context, repoPK int64, f PullFilter) (int, string, error)
PullListVersion returns the count and the latest updated_at marker of the pull requests matching the filter. It is the version seed for the pulls list ETag, the same shape as IssueListVersion. The marker covers both the issue row and the pull row: head pushes and mergeability recomputes bump pull_requests.updated_at without touching the issue, and both rows feed the rendered body. Markers are raw column text in one timestamp layout, so the larger of the two compares lexicographically.
func (*Store) PullNumberByPK ¶
PullNumberByPK resolves the issue number that backs a pull request, addressed by the pull extension's pk. The standalone review-comment lookup needs it to build the comment's pull request urls without the number in the request path.
func (*Store) ReactionRollupFor ¶
func (s *Store) ReactionRollupFor(ctx context.Context, subjectType string, subjectPK int64) (ReactionRollup, error)
ReactionRollupFor returns the reaction counts for a subject keyed by content.
func (*Store) ReactionRollupsBySubjectPKs ¶ added in v0.1.1
func (s *Store) ReactionRollupsBySubjectPKs(ctx context.Context, subjectType string, subjectPKs []int64) (map[int64]ReactionRollup, error)
ReactionRollupsBySubjectPKs loads reaction counts for multiple subjects of the same type in one query. Returns a map from subject_pk to its rollup.
func (*Store) RecomputeIssueCommentCounts ¶ added in v0.1.2
RecomputeIssueCommentCounts rebuilds issues.comments_count from the live issue_comments rows, so the denormalized counter the dataset shipped is replaced by one the corpus is internally consistent with.
func (*Store) RemoveReviewRequests ¶ added in v0.1.3
RemoveReviewRequests unlinks the given users from the pull request's requested reviewers in one statement.
func (*Store) ReplaceCodeDocs ¶ added in v0.1.3
func (s *Store) ReplaceCodeDocs(ctx context.Context, repoPK int64, headSHA string, truncated bool, docs []CodeDoc) error
ReplaceCodeDocs atomically replaces the repository's indexed documents and records the head sha they were built from. The whole swap is one transaction so a concurrent search never sees a half-replaced index.
func (*Store) RepoByDBID ¶
RepoByDBID loads a repository by its public database id.
func (*Store) RepoByOwnerName ¶
RepoByOwnerName resolves a repository by its owner login (case-insensitively, matching GitHub's case-preserving account and repo names) and repo name. It returns ErrNotFound when no live row matches.
func (*Store) RepoByRedirect ¶ added in v0.1.3
RepoByRedirect resolves an old owner/name pair through the redirect table to the repository it now points at. The caller runs the direct lookup first: a new repository that claims an old name shadows the redirect, matching GitHub. It returns ErrNotFound when no redirect matches or the target row is gone.
func (*Store) ReposByCollaborator ¶ added in v0.1.3
ReposByCollaborator lists the live repositories userPK holds a direct collaborator grant on, ordered by name. It backs the member type and the collaborator affiliation of the repository list endpoints.
func (*Store) ReposByOwner ¶ added in v0.1.3
ReposByOwner lists all non-deleted repositories belonging to ownerPK, ordered by name. It is used by the user.repositories field on User/RepositoryOwner.
func (*Store) ReposByTeamMember ¶ added in v0.1.3
ReposByTeamMember lists the live repositories userPK can reach through a team grant: the team_repos rows of every team the user belongs to. It backs the organization_member affiliation of GET /user/repos.
func (*Store) ReviewRequestsByPullPKs ¶ added in v0.1.3
func (s *Store) ReviewRequestsByPullPKs(ctx context.Context, pullPKs []int64) (map[int64][]int64, error)
ReviewRequestsByPullPKs loads the requested reviewers for the given pull PKs in one query, a map from pull_pk to the ordered reviewer user PKs, the bulk read the pulls list assembly uses.
func (*Store) Rollback ¶
Rollback reverts the last n applied migrations, most recent first. A zero or negative n is treated as 1.
func (*Store) SSHKeyByDBID ¶ added in v0.1.3
SSHKeyByDBID loads an SSH key by its public db_id.
func (*Store) SSHKeyByPK ¶ added in v0.1.3
SSHKeyByPK loads an SSH key by primary key.
func (*Store) SSHKeysByUser ¶ added in v0.1.3
SSHKeysByUser returns all SSH keys (not deploy keys) for a user.
func (*Store) SearchCode ¶ added in v0.1.3
SearchCode returns the page of indexed files matching the query, ordered by repository then path so pagination is deterministic.
func (*Store) SearchIssues ¶
SearchIssues returns the page of issues and pull requests matching the query, joined across every repository the viewer may see.
func (*Store) SearchRepositories ¶
SearchRepositories returns the page of repositories matching the query.
func (*Store) SearchUsers ¶ added in v0.1.3
SearchUsers returns the page of users matching the query.
func (*Store) SetCheckSuiteState ¶
func (s *Store) SetCheckSuiteState(ctx context.Context, pk int64, status string, conclusion *string) error
SetCheckSuiteState rolls a suite's status and conclusion forward, the summary the recompute derives from the suite's runs.
func (*Store) SetDeviceInterval ¶
SetDeviceInterval bumps the stored poll interval used to enforce slow_down.
func (*Store) SetDevicePolled ¶
SetDevicePolled records the most recent poll time for slow_down enforcement.
func (*Store) SetDeviceState ¶
SetDeviceState moves a device-flow row to approved or denied. userPK is the approving user; pass 0 on denial to leave user_pk NULL.
func (*Store) SetEventPayload ¶
SetEventPayload stores the rendered Events-API document on an event row, the body the feed serves once the fan-out worker has built it.
func (*Store) SetMergeability ¶
func (s *Store) SetMergeability(ctx context.Context, issuePK int64, mergeable *bool, state string, rebaseable *bool, additions, deletions, changedFiles, commits int, checkedAt time.Time) error
SetMergeability writes the derived merge state the worker computed: the tri-state mergeable, the mergeable_state string, the rebaseable flag, the diff stats, and the staleness stamp. A nil mergeable writes SQL NULL, the not-yet-computed value the read path surfaces as UNKNOWN.
func (*Store) SetNextIssueNumber ¶ added in v0.1.2
SetNextIssueNumber moves a repository's number allocator past the highest seeded number so the first live issue created after a seed does not collide with a preserved corpus number.
func (*Store) SetNotificationThreadSubscription ¶ added in v0.1.3
func (s *Store) SetNotificationThreadSubscription(ctx context.Context, pk int64, subscribed, ignored bool) error
SetNotificationThreadSubscription updates a thread's subscription flags.
func (*Store) SetPasswordHash ¶ added in v0.1.3
SetPasswordHash writes a new bcrypt hash for the given user pk. It is called on account creation and password change; it never reads the old hash.
func (*Store) SetThreadResolved ¶
func (s *Store) SetThreadResolved(ctx context.Context, rootPK int64, resolved bool, resolverPK *int64) error
SetThreadResolved resolves or unresolves the thread a comment roots: every comment sharing its root (itself or its in_reply_to chain head) flips together. resolverPK is recorded on resolve and cleared on unresolve.
func (*Store) SetWebhookLastResponse ¶
SetWebhookLastResponse records the JSON summary of the most recent delivery on the hook, the last_response the API surfaces.
func (*Store) SoftDeleteRepo ¶ added in v0.1.3
SoftDeleteRepo stamps deleted_at on the repository row, making it invisible to all the live-only queries. The git objects remain on disk; a separate async job handles disk cleanup.
func (*Store) StarCount ¶ added in v0.1.3
StarCount reports how many users have starred repoPK, the stargazers_count.
func (*Store) StargazersByRepo ¶ added in v0.1.3
func (s *Store) StargazersByRepo(ctx context.Context, repoPK int64, limit, offset int) ([]*UserRow, error)
StargazersByRepo lists the users who starred repoPK, most recent star first, paged by limit and offset.
func (*Store) StarredByUser ¶ added in v0.1.3
func (s *Store) StarredByUser(ctx context.Context, userPK int64, limit, offset int) ([]*RepoRow, error)
StarredByUser lists the repositories userPK starred, most recent star first, paged by limit and offset. The caller filters by visibility.
func (*Store) SubscriptionByRepo ¶ added in v0.1.3
func (s *Store) SubscriptionByRepo(ctx context.Context, userPK, repoPK int64) (*SubscriptionRow, error)
SubscriptionByRepo loads userPK's subscription on repoPK, or ErrNotFound when the user has set none.
func (*Store) SubscriptionsByUser ¶ added in v0.1.3
func (s *Store) SubscriptionsByUser(ctx context.Context, userPK int64, limit, offset int) ([]*RepoRow, error)
SubscriptionsByUser lists the repositories userPK is watching, paged by limit and offset. The caller filters by visibility.
func (*Store) TeamBySlug ¶ added in v0.1.3
TeamBySlug loads a team by its org and slug.
func (*Store) TeamMemberRole ¶ added in v0.1.3
TeamMemberRole returns the role of a user in a team, or ErrNotFound.
func (*Store) TeamRepoPermission ¶ added in v0.1.3
TeamRepoPermission returns the permission level for a repo in a team, or ErrNotFound.
func (*Store) TeamsByOrg ¶ added in v0.1.3
TeamsByOrg lists an org's teams, oldest first.
func (*Store) TokenByHash ¶
TokenByHash loads the token whose stored sha256 equals hash. The caller has already hashed the presented secret; the unique index on token_hash makes this a point lookup. Returns ErrNotFound when no row matches.
func (*Store) TokensForUser ¶ added in v0.1.3
TokensForUser lists a user's live personal access tokens, newest first, for the settings tokens page. Revoked rows stay out of the list; the hash column rides along but the caller never shows it.
func (*Store) TouchRepoPushedAt ¶
TouchRepoPushedAt advances pushed_at (and updated_at) to at, which the post-receive sink calls after a push so the pushed_at field and the pushed-sort order reflect the push. The time is stored in UTC to match how every other timestamp round-trips through the scanner.
func (*Store) UnstarGist ¶ added in v0.1.3
UnstarGist removes the star. Idempotent.
func (*Store) UpdateCheckRun ¶
func (s *Store) UpdateCheckRun(ctx context.Context, r *CheckRunRow) error
UpdateCheckRun rewrites a run's mutable fields, the transition a re-report or a run finishing performs.
func (*Store) UpdateComment ¶
func (s *Store) UpdateComment(ctx context.Context, c *CommentRow) error
UpdateComment changes a comment's body and stamps updated_at.
func (*Store) UpdateGist ¶ added in v0.1.3
func (s *Store) UpdateGist(ctx context.Context, gistPK int64, description *string, files map[string]*string) error
UpdateGist updates description and/or files. Pass nil description to leave unchanged. Files map: nil value deletes the file, non-nil updates/creates it.
func (*Store) UpdateGistComment ¶ added in v0.1.3
UpdateGistComment rewrites a comment's body and bumps updated_at.
func (*Store) UpdateLabel ¶
UpdateLabel changes a label's name, color, and description, returning the updated row.
func (*Store) UpdateMilestone ¶
func (s *Store) UpdateMilestone(ctx context.Context, m *MilestoneRow) error
UpdateMilestone writes the editable fields and the close transition (state flipping to closed stamps closed_at; reopening clears it).
func (*Store) UpdateProfile ¶ added in v0.1.3
UpdateProfile writes the non-nil fields from u onto the users row at userPK. Every non-nil field is included in the SET clause; nil fields are not touched, so the caller can update a single field without loading the whole row first.
func (*Store) UpdatePullDraft ¶ added in v0.1.3
UpdatePullDraft flips the draft flag on a pull request.
func (*Store) UpdateRelease ¶ added in v0.1.3
func (s *Store) UpdateRelease(ctx context.Context, r *ReleaseRow) error
UpdateRelease writes editable fields back to an existing release using optimistic locking on lock_version.
func (*Store) UpdateReleaseAsset ¶ added in v0.1.3
func (s *Store) UpdateReleaseAsset(ctx context.Context, a *ReleaseAssetRow) error
UpdateReleaseAsset writes editable fields (name, label, state) back to an existing asset using optimistic locking.
func (*Store) UpdateRepo ¶ added in v0.1.3
UpdateRepo applies p to the repository identified by pk and returns the updated row. Fields in p that are nil are left unchanged. updated_at is always stamped to now.
func (*Store) UpdateRepoTopics ¶ added in v0.1.3
UpdateRepoTopics replaces the topics JSON for a repository.
func (*Store) UpdateReviewBody ¶ added in v0.1.3
UpdateReviewBody replaces a review's summary body, the PUT review shape.
func (*Store) UpdateReviewCommentBody ¶
UpdateReviewCommentBody changes an inline comment's body and stamps updated_at.
func (*Store) UpdateTeam ¶ added in v0.1.3
func (s *Store) UpdateTeam(ctx context.Context, pk int64, name, description, privacy, permission *string) (*TeamRow, error)
UpdateTeam applies partial updates to a team.
func (*Store) UpdateWebhook ¶
func (s *Store) UpdateWebhook(ctx context.Context, w *WebhookRow) error
UpdateWebhook writes the editable fields of an existing webhook and stamps updated_at. The service loads the row, applies the patch, and calls this.
func (*Store) UpsertBranchProtection ¶ added in v0.1.3
func (s *Store) UpsertBranchProtection(ctx context.Context, r *BranchProtectionRow) error
UpsertBranchProtection inserts or replaces a branch protection rule.
func (*Store) UpsertCollaborator ¶ added in v0.1.3
func (s *Store) UpsertCollaborator(ctx context.Context, repoPK, userPK int64, permission string) error
UpsertCollaborator sets (or updates) a collaborator's permission on a repo.
func (*Store) UpsertNotificationThread ¶ added in v0.1.3
func (s *Store) UpsertNotificationThread(ctx context.Context, r *NotificationThreadRow) error
UpsertNotificationThread records that something happened on an issue the user should hear about. A fresh thread starts unread; an existing one is bumped to unread with the new reason and timestamp unless the user has ignored it, in which case only the timestamp moves.
func (*Store) UpsertOrgMember ¶ added in v0.1.3
UpsertOrgMember adds or updates a user's membership role in an org.
func (*Store) UpsertPullCheckState ¶
func (s *Store) UpsertPullCheckState(ctx context.Context, pullPK int64, decision *string, rollup string, at time.Time) error
UpsertPullCheckState writes a pull request's derived review decision and rollup state, the snapshot the recompute worker refreshes on review and status change.
func (*Store) UpsertRepoRedirect ¶ added in v0.1.3
func (s *Store) UpsertRepoRedirect(ctx context.Context, oldOwner, oldName string, repoPK int64) error
UpsertRepoRedirect records that the repository at repoPK used to live at oldOwner/oldName, so the old URL can 301 to the current one. The keys are stored lowercased to match the case-insensitive lookup; rebinding an old name that already redirects repoints it at repoPK, which keeps a rename chain collapsing to wherever the repository currently lives.
func (*Store) UpsertSubscription ¶ added in v0.1.3
func (s *Store) UpsertSubscription(ctx context.Context, userPK, repoPK int64, subscribed, ignored bool) error
UpsertSubscription sets userPK's subscription on repoPK to the given flags, creating the row when absent and overwriting it when present, the way a PUT /repos/{o}/{r}/subscription replaces the whole subscription.
func (*Store) UpsertTeamMember ¶ added in v0.1.3
UpsertTeamMember adds or updates a team member's role.
func (*Store) UpsertTeamRepo ¶ added in v0.1.3
UpsertTeamRepo adds or updates a team's permission on a repo.
func (*Store) UserByLogin ¶
UserByLogin loads a user by login, case-insensitively, matching GitHub's case-preserving but case-insensitive account names.
func (*Store) UserByPK ¶
UserByPK loads a user by primary key. It returns ErrNotFound when no live row matches.
func (*Store) UserLoginExists ¶ added in v0.1.3
UserLoginExists reports whether a user with the given login exists and is not soft-deleted. Used by the join form to check for duplicate usernames before attempting to insert.
func (*Store) UsersByPKs ¶ added in v0.1.1
UsersByPKs loads users by primary key in one round trip. PKs that have no live row are silently absent from the returned map.
func (*Store) Version ¶
Version reports the highest applied migration version, or 0 when none have been applied.
func (*Store) VisibleRepoPKs ¶
func (s *Store) VisibleRepoPKs(ctx context.Context, viewerPK int64, ownerPKs []int64) ([]int64, error)
VisibleRepoPKs lists the internal pks of every repository the viewer may see among the given owners, deleted rows excluded. Code search uses it to scope a git tree walk to the repositories a user:/org: qualifier selects. An empty owners slice lists every visible repository.
func (*Store) WatcherCount ¶ added in v0.1.3
WatcherCount reports how many users are subscribed to repoPK (watching, not ignoring), the watchers_count GitHub renders.
func (*Store) WatchersByRepo ¶ added in v0.1.3
func (s *Store) WatchersByRepo(ctx context.Context, repoPK int64, limit, offset int) ([]*UserRow, error)
WatchersByRepo lists the users watching repoPK (subscribed, not ignoring), paged by limit and offset.
type SubscriptionRow ¶ added in v0.1.3
type SubscriptionRow struct {
PK int64
UserPK int64
RepoPK int64
Subscribed bool
Ignored bool
CreatedAt time.Time
}
SubscriptionRow is a row of the repo_subscriptions table: a user watching a repository. Subscribed and Ignored mirror GitHub's subscription shape, where a row exists once a user has explicitly set either, and "watching" is the Subscribed-and-not-Ignored case.
type TeamRow ¶ added in v0.1.3
type TeamRow struct {
PK int64
DBID int64
OrgPK int64
Name string
Slug string
Description *string
Privacy string
Permission string
CreatedAt time.Time
UpdatedAt time.Time
}
TeamRow is a row of the teams table.
type TokenRow ¶
type TokenRow struct {
PK int64
UserPK *int64
OAuthAppPK *int64
InstallationPK *int64
GitHubAppPK *int64
GrantJSON *string
TokenHash []byte
TokenPrefix string
LastEight string
Kind string // pat | oauth | installation
Scopes string // comma-space header form, the X-OAuth-Scopes value
Note string
ExpiresAt *time.Time
RevokedAt *time.Time
LastUsedAt *time.Time
CreatedAt time.Time
}
TokenRow is a row of the tokens table. UserPK and OAuthAppPK are nullable because installation and app credentials (later milestones) have no user, and PATs have no granting OAuth app.
type Tx ¶
type Tx struct {
// contains filtered or unexported fields
}
Tx is a transaction-scoped handle the multi-statement writes run through, so a mutation and the timeline and counter updates it implies all commit together or not at all. It exposes the same write methods the store does, bound to one *sql.Tx.
func (*Tx) AddAssignees ¶
AddAssignees links the given users to the issue, preserving request order in the position column and ignoring users already assigned.
func (*Tx) AddLabels ¶ added in v0.1.3
AddLabels attaches the given labels to an issue, ignoring any that are already attached. It is the additive counterpart to ReplaceLabels.
func (*Tx) AdjustOpenIssuesCount ¶
AdjustOpenIssuesCount bumps the repositories.open_issues_count cache when an issue opens or closes so the repository view need not aggregate on read.
func (*Tx) AllocIssueNumber ¶
AllocIssueNumber atomically hands out the next per-repo issue/PR number from the shared counter, so an issue and a pull request never collide.
func (*Tx) AttachLabels ¶
AttachLabels links the given labels to the issue, ignoring any already linked. All rows go in one multi-row insert: the tx holds the single-writer lock, so per-item statements would stretch the hold for no benefit.
func (*Tx) BumpCommentsCount ¶
BumpCommentsCount adjusts an issue's cached comment count and advances its updated_at, so the issue view need not aggregate comments on read.
func (*Tx) DetachLabel ¶
DetachLabel removes one label from an issue.
func (*Tx) InsertComment ¶
func (t *Tx) InsertComment(ctx context.Context, c *CommentRow) error
InsertComment is the transaction-scoped form, so a comment created as part of a larger unit of work shares its atomicity.
func (*Tx) InsertEvent ¶
InsertEvent appends one event row inside an existing transaction.
func (*Tx) InsertIssue ¶
InsertIssue writes the issue row with a freshly allocated db_id and the number the caller already allocated, filling the server-assigned fields back onto iss.
func (*Tx) InsertIssueEvent ¶
func (t *Tx) InsertIssueEvent(ctx context.Context, e *IssueEventRow) error
InsertIssueEvent appends a timeline event (closed, reopened, labeled, ...) to an issue's history. Payload is a JSON document the event renderer decodes.
func (*Tx) InsertLabel ¶
InsertLabel writes a label inside a transaction, used to seed a repository's default label set as part of the repository-create unit of work.
func (*Tx) InsertPull ¶
InsertPull writes the pull request extension row with a freshly allocated db_id, filling the server-assigned fields back onto p. It runs inside the same transaction as the issue insert it extends, so a pull request and its issue row commit together.
func (*Tx) InsertReview ¶
InsertReview writes a review row with a freshly allocated db_id, filling the server-assigned fields back onto r.
func (*Tx) InsertReviewComment ¶
func (t *Tx) InsertReviewComment(ctx context.Context, c *ReviewCommentRow) error
InsertReviewComment writes one inline comment with a freshly allocated db_id, filling the server-assigned fields back onto c.
func (*Tx) MarkMerged ¶
func (t *Tx) MarkMerged(ctx context.Context, pullPK int64, mergerPK int64, mergeCommitSHA string, mergedAt time.Time) error
MarkMerged records a successful merge: the merged flag, the instant, the merger, and the merge commit sha. It runs in the same transaction as the issue close so a merged pull request is also a closed issue.
func (*Tx) RemoveAssignees ¶
RemoveAssignees unlinks the given users from the issue in one statement.
func (*Tx) RemoveLabels ¶ added in v0.1.3
RemoveLabels detaches the given labels from an issue, ignoring any that are not currently attached.
func (*Tx) ReplaceAssignees ¶
ReplaceAssignees sets an issue's assignees to exactly the given set.
func (*Tx) ReplaceLabels ¶
ReplaceLabels sets an issue's labels to exactly the given set.
func (*Tx) SeedComment ¶ added in v0.1.2
func (t *Tx) SeedComment(ctx context.Context, c *CommentRow) error
SeedComment inserts one issue_comments row preserving its timestamps.
func (*Tx) SeedCommitStatus ¶ added in v0.1.2
func (t *Tx) SeedCommitStatus(ctx context.Context, st *CommitStatusRow) error
SeedCommitStatus inserts one commit_statuses row preserving its timestamps.
func (*Tx) SeedIssue ¶ added in v0.1.2
SeedIssue inserts one issues row with the per-repo number preserved from the corpus so URLs match real GitHub paths, all state fields and timestamps written verbatim. It fills PK and DBID. The table is shared by issues and pull requests; IsPull tells them apart.
func (*Tx) SeedIssueEvent ¶ added in v0.1.2
func (t *Tx) SeedIssueEvent(ctx context.Context, e *IssueEventRow) error
SeedIssueEvent inserts one issue_events timeline row preserving its created_at and the rendered payload, filling PK and DBID. This is the largest table in a real-world corpus, so the timeline and events-feed reads run against realistic volume.
func (*Tx) SeedIssueEventsBulk ¶ added in v0.1.2
func (t *Tx) SeedIssueEventsBulk(ctx context.Context, rows []IssueEventRow) error
SeedIssueEventsBulk inserts many issue_events rows in chunked multi-row INSERTs over one batch-allocated id range, preserving each row's created_at and rendered payload. The timeline is the largest table in an automation-heavy corpus, so this is the bulk path that makes seeding it feasible.
func (*Tx) SeedLabel ¶ added in v0.1.2
SeedLabel inserts one labels row preserving its timestamps, filling PK and DBID. The caller dedupes labels per repository before calling.
func (*Tx) SeedMilestone ¶ added in v0.1.2
func (t *Tx) SeedMilestone(ctx context.Context, m *MilestoneRow) error
SeedMilestone inserts one milestones row with the number preserved from the corpus (not allocated), filling PK and DBID.
func (*Tx) SeedPull ¶ added in v0.1.2
SeedPull inserts one pull_requests row joined to its issue, with the merge state and diff stats written verbatim. mergeable is left NULL (the not-yet-computed contract) unless the corpus carried a value.
func (*Tx) SeedReaction ¶ added in v0.1.2
func (t *Tx) SeedReaction(ctx context.Context, r *ReactionRow) error
SeedReaction inserts one reactions row preserving its created_at. The caller supplies the reactor user pk; the corpus carries counts, not per-user rows, so the seeder materializes them against a bounded reactor pool.
func (*Tx) SeedReactionsBulk ¶ added in v0.1.2
func (t *Tx) SeedReactionsBulk(ctx context.Context, rows []ReactionRow) error
SeedReactionsBulk inserts many reactions rows in chunked multi-row INSERTs over one batch-allocated id range, preserving each row's created_at. It is the bulk analog of SeedReaction for the seeder's materialized reactor-pool rows, which are the most numerous synthesized rows in a corpus.
func (*Tx) SeedRepo ¶ added in v0.1.2
SeedRepo inserts one repositories row preserving its timestamps and pushed_at, filling PK and DBID back onto r. next_issue_number keeps its default; the caller sets it past the seeded numbers with SetNextIssueNumber once the issues are in.
func (*Tx) SeedReview ¶ added in v0.1.2
SeedReview inserts one pull_request_reviews row preserving submitted_at and the timestamps.
func (*Tx) SeedReviewComment ¶ added in v0.1.2
func (t *Tx) SeedReviewComment(ctx context.Context, c *ReviewCommentRow) error
SeedReviewComment inserts one pull_request_review_comments row preserving the diff anchor and the reply linkage so threaded conversations reassemble.
func (*Tx) SeedUser ¶ added in v0.1.2
SeedUser inserts one users row preserving its timestamps, filling PK and DBID back onto u. The profile columns keep their defaults; a corpus carries identity, not full profiles.
func (*Tx) SubmitReview ¶
func (t *Tx) SubmitReview(ctx context.Context, pk int64, state, body, commitID string, submittedAt time.Time) error
SubmitReview stamps a pending review with its final state, body, and submit instant, the transition from draft to a review the pull request shows.
func (*Tx) TouchIssue ¶
TouchIssue bumps an issue's updated_at without touching the optimistic lock, used when a related row (a comment, a reaction) changes and GitHub advances the issue's updated timestamp.
func (*Tx) UpdateIssue ¶
UpdateIssue writes the editable fields under an optimistic lock: the row is updated only if its lock_version still matches the one read, and lock_version is bumped. A no-row result means a concurrent writer moved first; the caller re-reads and retries. The close transition (state, closed_at, closed_by_pk, state_reason) is written here too.
func (*Tx) UpdatePullHead ¶
UpdatePullHead repoints a pull request's head sha after a push to its head branch and clears the mergeability stamp so the next read treats the cached merge state as stale.
func (*Tx) UpdatePullMeta ¶ added in v0.1.3
func (t *Tx) UpdatePullMeta(ctx context.Context, pullPK int64, baseRef string, draft, maintainerCanModify bool) error
UpdatePullMeta updates the editable metadata of a pull request row: the base branch, draft flag, and maintainer-can-modify flag. The merge state stays intact; callers that change the base branch must enqueue a recompute separately.
type UserRow ¶
type UserRow struct {
PK int64
DBID int64
Login string
Type string
Name *string
Email *string
SiteAdmin bool
Company *string
Blog string
Location *string
Bio *string
Hireable *bool
TwitterUsername *string
PublicRepos int
PublicGists int
Followers int
Following int
CreatedAt time.Time
UpdatedAt time.Time
}
UserRow is a row of the users table, including the profile columns 0002 adds.
type UserSearch ¶ added in v0.1.3
type UserSearch struct {
Terms []string
Type string // "user" | "org"; "" is both
Sort string // "joined" | "followers" | "repositories"; "" is best-match (db_id)
Order string // "asc" | "desc"; "" is desc
Limit int
Offset int
}
UserSearch filters the cross-account user search. Terms match the login, the display name, and (when public) the email; the type filter narrows to User or Organization accounts. Sort orders by join date or follower count.
type WebhookDeliveryRow ¶
type WebhookDeliveryRow struct {
PK int64
DBID int64
WebhookPK int64
GUID string
Event string
Action string
StatusCode *int64
RequestURL string
RequestHeaders string
RequestBody string
ResponseHeaders string
ResponseBody string
DurationMS int64
Redelivery bool
Success bool
CreatedAt time.Time
}
WebhookDeliveryRow is a row of the webhook_deliveries table: the recorded result of one POST to a webhook. StatusCode is nullable because a transport failure (connection refused, timeout) produces no HTTP status. Redelivery marks a delivery that replayed an earlier one; Success is the 2xx outcome.
type WebhookRow ¶
type WebhookRow struct {
PK int64
DBID int64
RepoPK int64
Name string
URL string
ContentType string
Secret *string
InsecureSSL bool
Active bool
Events string
LastResponse *string
CreatedAt time.Time
UpdatedAt time.Time
}
WebhookRow is a row of the webhooks table: a repository's registration of a URL to POST events to. Secret is nullable and held in the clear because HMAC signing needs the original bytes; the API always redacts it. Events is the JSON array of subscribed event names ("*" means all). LastResponse is the JSON summary of the most recent delivery, nil until the first POST.
Source Files
¶
- bulk.go
- cursor.go
- dialect.go
- migrate.go
- queries_assignee.go
- queries_auth_code.go
- queries_batch.go
- queries_checks.go
- queries_code.go
- queries_comment.go
- queries_event.go
- queries_gist.go
- queries_github_app.go
- queries_issue.go
- queries_jobs.go
- queries_keys.go
- queries_label.go
- queries_milestone.go
- queries_notifications.go
- queries_oauth.go
- queries_pull.go
- queries_reaction.go
- queries_release.go
- queries_repo.go
- queries_review.go
- queries_review_request.go
- queries_search.go
- queries_social.go
- queries_teams.go
- queries_token.go
- queries_user.go
- queries_webhook.go
- rows.go
- scan.go
- seed.go
- store.go
- tx.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package migrations holds Githome's embedded SQL schema migrations and exposes them as a read-only filesystem for the store's migration runner.
|
Package migrations holds Githome's embedded SQL schema migrations and exposes them as a read-only filesystem for the store's migration runner. |