Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ContextKey = &struct{ string }{"store"}
ContextKey is the store context key.
Functions ¶
Types ¶
type AccessTokenStore ¶
type AccessTokenStore interface {
GetAccessToken(ctx context.Context, h db.Handler, id int64) (models.AccessToken, error)
GetAccessTokenByToken(ctx context.Context, h db.Handler, token string) (models.AccessToken, error)
GetAccessTokensByUserID(ctx context.Context, h db.Handler, userID int64) ([]models.AccessToken, error)
CreateAccessToken(ctx context.Context, h db.Handler, name string, userID int64, token string, expiresAt time.Time) (models.AccessToken, error)
DeleteAccessToken(ctx context.Context, h db.Handler, id int64) error
DeleteAccessTokenForUser(ctx context.Context, h db.Handler, userID int64, id int64) error
}
AccessTokenStore is an interface for managing access tokens.
type CollaboratorStore ¶
type CollaboratorStore interface {
GetCollabByUsernameAndRepo(ctx context.Context, h db.Handler, username string, repo string) (models.Collab, error)
AddCollabByUsernameAndRepo(ctx context.Context, h db.Handler, username string, repo string, level access.AccessLevel) error
RemoveCollabByUsernameAndRepo(ctx context.Context, h db.Handler, username string, repo string) error
ListCollabsByRepo(ctx context.Context, h db.Handler, repo string) ([]models.Collab, error)
ListCollabsByRepoAsUsers(ctx context.Context, h db.Handler, repo string) ([]models.User, error)
}
CollaboratorStore is an interface for managing collaborators.
type LFSStore ¶
type LFSStore interface {
CreateLFSObject(ctx context.Context, h db.Handler, repoID int64, oid string, size int64) error
GetLFSObjectByOid(ctx context.Context, h db.Handler, repoID int64, oid string) (models.LFSObject, error)
GetLFSObjects(ctx context.Context, h db.Handler, repoID int64) ([]models.LFSObject, error)
GetLFSObjectsByName(ctx context.Context, h db.Handler, name string) ([]models.LFSObject, error)
DeleteLFSObjectByOid(ctx context.Context, h db.Handler, repoID int64, oid string) error
CreateLFSLockForUser(ctx context.Context, h db.Handler, repoID int64, userID int64, path string, refname string) error
GetLFSLocks(ctx context.Context, h db.Handler, repoID int64, page int, limit int) ([]models.LFSLock, error)
GetLFSLocksWithCount(ctx context.Context, h db.Handler, repoID int64, page int, limit int) ([]models.LFSLock, int64, error)
GetLFSLocksForUser(ctx context.Context, h db.Handler, repoID int64, userID int64) ([]models.LFSLock, error)
GetLFSLockForPath(ctx context.Context, h db.Handler, repoID int64, path string) (models.LFSLock, error)
GetLFSLockForUserPath(ctx context.Context, h db.Handler, repoID int64, userID int64, path string) (models.LFSLock, error)
GetLFSLockByID(ctx context.Context, h db.Handler, id int64) (models.LFSLock, error)
GetLFSLockForUserByID(ctx context.Context, h db.Handler, repoID int64, userID int64, id int64) (models.LFSLock, error)
DeleteLFSLock(ctx context.Context, h db.Handler, repoID int64, id int64) error
DeleteLFSLockForUserByID(ctx context.Context, h db.Handler, repoID int64, userID int64, id int64) error
}
LFSStore is the interface for the LFS store.
type RepositoryStore ¶
type RepositoryStore interface {
GetRepoByName(ctx context.Context, h db.Handler, name string) (models.Repo, error)
GetAllRepos(ctx context.Context, h db.Handler) ([]models.Repo, error)
GetUserRepos(ctx context.Context, h db.Handler, userID int64) ([]models.Repo, error)
CreateRepo(ctx context.Context, h db.Handler, name string, userID int64, projectName string, description string, isPrivate bool, isHidden bool, isMirror bool) error
DeleteRepoByName(ctx context.Context, h db.Handler, name string) error
SetRepoNameByName(ctx context.Context, h db.Handler, name string, newName string) error
GetRepoProjectNameByName(ctx context.Context, h db.Handler, name string) (string, error)
SetRepoProjectNameByName(ctx context.Context, h db.Handler, name string, projectName string) error
GetRepoDescriptionByName(ctx context.Context, h db.Handler, name string) (string, error)
SetRepoDescriptionByName(ctx context.Context, h db.Handler, name string, description string) error
GetRepoIsPrivateByName(ctx context.Context, h db.Handler, name string) (bool, error)
SetRepoIsPrivateByName(ctx context.Context, h db.Handler, name string, isPrivate bool) error
GetRepoIsHiddenByName(ctx context.Context, h db.Handler, name string) (bool, error)
SetRepoIsHiddenByName(ctx context.Context, h db.Handler, name string, isHidden bool) error
GetRepoIsMirrorByName(ctx context.Context, h db.Handler, name string) (bool, error)
}
RepositoryStore is an interface for managing repositories.
type SettingStore ¶
type SettingStore interface {
GetAnonAccess(ctx context.Context, h db.Handler) (access.AccessLevel, error)
SetAnonAccess(ctx context.Context, h db.Handler, level access.AccessLevel) error
GetAllowKeylessAccess(ctx context.Context, h db.Handler) (bool, error)
SetAllowKeylessAccess(ctx context.Context, h db.Handler, allow bool) error
}
SettingStore is an interface for managing settings.
type Store ¶
type Store interface {
RepositoryStore
UserStore
CollaboratorStore
SettingStore
LFSStore
AccessTokenStore
}
Store is an interface for managing repositories, users, and settings.
func FromContext ¶
FromContext returns the store from the given context.
type UserStore ¶
type UserStore interface {
GetUserByID(ctx context.Context, h db.Handler, id int64) (models.User, error)
FindUserByUsername(ctx context.Context, h db.Handler, username string) (models.User, error)
FindUserByPublicKey(ctx context.Context, h db.Handler, pk ssh.PublicKey) (models.User, error)
FindUserByAccessToken(ctx context.Context, h db.Handler, token string) (models.User, error)
GetAllUsers(ctx context.Context, h db.Handler) ([]models.User, error)
CreateUser(ctx context.Context, h db.Handler, username string, isAdmin bool, pks []ssh.PublicKey) error
DeleteUserByUsername(ctx context.Context, h db.Handler, username string) error
SetUsernameByUsername(ctx context.Context, h db.Handler, username string, newUsername string) error
SetAdminByUsername(ctx context.Context, h db.Handler, username string, isAdmin bool) error
AddPublicKeyByUsername(ctx context.Context, h db.Handler, username string, pk ssh.PublicKey) error
RemovePublicKeyByUsername(ctx context.Context, h db.Handler, username string, pk ssh.PublicKey) error
ListPublicKeysByUserID(ctx context.Context, h db.Handler, id int64) ([]ssh.PublicKey, error)
ListPublicKeysByUsername(ctx context.Context, h db.Handler, username string) ([]ssh.PublicKey, error)
SetUserPassword(ctx context.Context, h db.Handler, userID int64, password string) error
SetUserPasswordByUsername(ctx context.Context, h db.Handler, username string, password string) error
}
UserStore is an interface for managing users.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.