chore: Add docs for RepoStore methods (#64283)

This commit is contained in:
Varun Gandhi 2024-08-07 21:27:37 +08:00 committed by GitHub
parent e4e1f55026
commit e1e78988aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -72,13 +72,40 @@ type RepoStore interface {
Count(context.Context, ReposListOptions) (int, error)
Create(context.Context, ...*types.Repo) error
Delete(context.Context, ...api.RepoID) error
// Get gets information about a single repo.
//
// Prefer using GetByIDs or GetReposSetByIDs for bulk retrieval.
//
// Returns database.RepoNotFoundErr if the repo was not found.
// Returns types.BlockedRepoError if the repo was blocked.
Get(context.Context, api.RepoID) (*types.Repo, error)
// GetByIDs returns a slice containing information about repos present on the instance.
//
// The slice may have fewer entries than the number of input RepoIDs,
// due to repos not being found or having been deleted/blocked etc.
//
// Even if the number of elements matches, the caller may not assume anything
// about ordering. Use the ID field on each types.Repo value instead.
GetByIDs(context.Context, ...api.RepoID) ([]*types.Repo, error)
// GetByName is analogous to Get but using an api.RepoName.
//
// Prefer using Get over GetByName for trusted input.
//
// Returns database.RepoNotFoundErr if the repo was not found.
// Returns types.BlockedRepoError if the repo was blocked.
GetByName(context.Context, api.RepoName) (*types.Repo, error)
GetByHashedName(context.Context, api.RepoHashedName) (*types.Repo, error)
GetFirstRepoNameByCloneURL(context.Context, string) (api.RepoName, error)
GetFirstRepoByCloneURL(context.Context, string) (*types.Repo, error)
// GetReposSetByIDs returns a map containing information about repos present on the instance.
//
// The map may have fewer key-value pairs than the number of input RepoIDs,
// due to repos not being found or having been deleted/blocked etc.
GetReposSetByIDs(context.Context, ...api.RepoID) (map[api.RepoID]*types.Repo, error)
// GetRepoDescriptionsByIDs returns descriptions about repos present on the instance.
//
// The map may have fewer key-value pairs than the number of input RepoIDs,
// due to repos not being found or having been deleted/blocked etc.
GetRepoDescriptionsByIDs(context.Context, ...api.RepoID) (map[api.RepoID]string, error)
List(context.Context, ReposListOptions) ([]*types.Repo, error)
ListMinimalRepos(context.Context, ReposListOptions) ([]types.MinimalRepo, error)