Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

Commit e1e7898

Browse files
chore: Add docs for RepoStore methods (#64283)
1 parent e4e1f55 commit e1e7898

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

internal/database/repos.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,13 +72,40 @@ type RepoStore interface {
7272
Count(context.Context, ReposListOptions) (int, error)
7373
Create(context.Context, ...*types.Repo) error
7474
Delete(context.Context, ...api.RepoID) error
75+
// Get gets information about a single repo.
76+
//
77+
// Prefer using GetByIDs or GetReposSetByIDs for bulk retrieval.
78+
//
79+
// Returns database.RepoNotFoundErr if the repo was not found.
80+
// Returns types.BlockedRepoError if the repo was blocked.
7581
Get(context.Context, api.RepoID) (*types.Repo, error)
82+
// GetByIDs returns a slice containing information about repos present on the instance.
83+
//
84+
// The slice may have fewer entries than the number of input RepoIDs,
85+
// due to repos not being found or having been deleted/blocked etc.
86+
//
87+
// Even if the number of elements matches, the caller may not assume anything
88+
// about ordering. Use the ID field on each types.Repo value instead.
7689
GetByIDs(context.Context, ...api.RepoID) ([]*types.Repo, error)
90+
// GetByName is analogous to Get but using an api.RepoName.
91+
//
92+
// Prefer using Get over GetByName for trusted input.
93+
//
94+
// Returns database.RepoNotFoundErr if the repo was not found.
95+
// Returns types.BlockedRepoError if the repo was blocked.
7796
GetByName(context.Context, api.RepoName) (*types.Repo, error)
7897
GetByHashedName(context.Context, api.RepoHashedName) (*types.Repo, error)
7998
GetFirstRepoNameByCloneURL(context.Context, string) (api.RepoName, error)
8099
GetFirstRepoByCloneURL(context.Context, string) (*types.Repo, error)
100+
// GetReposSetByIDs returns a map containing information about repos present on the instance.
101+
//
102+
// The map may have fewer key-value pairs than the number of input RepoIDs,
103+
// due to repos not being found or having been deleted/blocked etc.
81104
GetReposSetByIDs(context.Context, ...api.RepoID) (map[api.RepoID]*types.Repo, error)
105+
// GetRepoDescriptionsByIDs returns descriptions about repos present on the instance.
106+
//
107+
// The map may have fewer key-value pairs than the number of input RepoIDs,
108+
// due to repos not being found or having been deleted/blocked etc.
82109
GetRepoDescriptionsByIDs(context.Context, ...api.RepoID) (map[api.RepoID]string, error)
83110
List(context.Context, ReposListOptions) ([]*types.Repo, error)
84111
ListMinimalRepos(context.Context, ReposListOptions) ([]types.MinimalRepo, error)

0 commit comments

Comments
 (0)