Documentation
¶
Index ¶
- Constants
- Variables
- func AccessibleRepoIDsQuery(user *user_model.User) *builder.Builder
- func AccessibleRepositoryCondition(user *user_model.User, unitType unit.Type) builder.Cond
- func ActivatePagesDomainSSL(ctx context.Context, id int64) error
- func AddReleaseAttachments(ctx context.Context, releaseID int64, attachmentUUIDs []string) (err error)
- func AttachmentRelativePath(uuid string) string
- func ChangeCollaborationAccessMode(ctx context.Context, repo *Repository, uid int64, mode perm.AccessMode) error
- func CleanRepoLicenses(ctx context.Context, repo *Repository) error
- func ClearRepoStars(ctx context.Context, repoID int64) error
- func ComposeHTTPSCloneURL(ctx context.Context, owner, repo string) string
- func ComposeSSHCloneURL(doer *user_model.User, ownerName, repoName string) string
- func ComposeTeaCloneCommand(ctx context.Context, owner, repo string) string
- func CopyLanguageStat(ctx context.Context, originalRepo, destRepo *Repository) error
- func CopyLicense(ctx context.Context, originalRepo, destRepo *Repository) error
- func CountNullArchivedRepository(ctx context.Context) (int64, error)
- func CountOrgRepoStars(ctx context.Context, orgID int64) (int64, error)
- func CountOrphanedAttachments(ctx context.Context) (int64, error)
- func CountOrphanedTopics(ctx context.Context) (int64, error)
- func CountRepositories(ctx context.Context, opts CountRepositoryOptions) (int64, error)
- func CountRepository(ctx context.Context, opts SearchRepoOptions) (int64, error)
- func CreateOrUpdateWikiIndex(ctx context.Context, idx *WikiIndex) error
- func CreatePagesConfig(ctx context.Context, config *PagesConfig) error
- func CreatePagesDomain(ctx context.Context, domain *PagesDomain) error
- func CreatePendingRepositoryTransfer(ctx context.Context, doer, newOwner *user_model.User, repoID int64, ...) error
- func CreateUploadSession(ctx context.Context, session *UploadSession) error
- func DecrementRepoForkNum(ctx context.Context, repoID int64) error
- func DeleteAllRepoArchives(ctx context.Context) error
- func DeleteAttachment(ctx context.Context, a *Attachment, remove bool) error
- func DeleteAttachments(ctx context.Context, attachments []*Attachment, remove bool) (int, error)
- func DeleteAttachmentsByComment(ctx context.Context, commentID int64, remove bool) (int, error)
- func DeleteAttachmentsByIssue(ctx context.Context, issueID int64, remove bool) (int, error)
- func DeleteAttachmentsByRelease(ctx context.Context, releaseID int64) error
- func DeleteExpiredUploadSessions(ctx context.Context) (int, error)
- func DeleteMirrorByRepoID(ctx context.Context, repoID int64) error
- func DeleteOrphanedAttachments(ctx context.Context) error
- func DeleteOrphanedTopics(ctx context.Context) (int64, error)
- func DeletePagesConfig(ctx context.Context, repoID int64) error
- func DeletePagesDomain(ctx context.Context, id int64) error
- func DeletePagesDomainsByRepoID(ctx context.Context, repoID int64) error
- func DeletePushMirrors(ctx context.Context, opts PushMirrorOptions) error
- func DeleteRedirect(ctx context.Context, ownerID int64, repoName string) error
- func DeleteRepoReleases(ctx context.Context, repoID int64) error
- func DeleteRepositoryTransfer(ctx context.Context, repoID int64) error
- func DeleteUploadByUUID(ctx context.Context, uuid string) error
- func DeleteUploadSession(ctx context.Context, session *UploadSession) error
- func DeleteUploadSessionByUUID(ctx context.Context, uuid string) error
- func DeleteUploads(ctx context.Context, uploads ...*Upload) (err error)
- func DeleteWikiIndex(ctx context.Context, repoID int64, pageName string) error
- func DeleteWikiIndexByRepo(ctx context.Context, repoID int64) error
- func DisablePages(ctx context.Context, repoID int64) error
- func EnablePages(ctx context.Context, repoID int64, template PagesTemplate) error
- func ExistAttachmentsByUUID(ctx context.Context, uuid string) (bool, error)
- func ExistsRepoArchiverWithStoragePath(ctx context.Context, storagePath string) (bool, error)
- func ExistsWithAvatarAtStoragePath(ctx context.Context, storagePath string) (bool, error)
- func FindTagsByCommitIDs(ctx context.Context, repoID int64, commitIDs ...string) (map[string][]*Release, error)
- func FindUserCodeAccessibleOwnerRepoIDs(ctx context.Context, ownerID int64, user *user_model.User) ([]int64, error)
- func FindUserCodeAccessibleRepoIDs(ctx context.Context, user *user_model.User) ([]int64, error)
- func FixNullArchivedRepository(ctx context.Context) (int64, error)
- func GenerateTopics(ctx context.Context, templateRepo, generateRepo *Repository) error
- func GenerateVerificationToken() (string, error)
- func GetIssuePostersWithSearch(ctx context.Context, repo *Repository, isPull bool, search string, ...) ([]*user_model.User, error)
- func GetReleaseAttachments(ctx context.Context, rels ...*Release) (err error)
- func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.User, err error)
- func GetRepoWatchers(ctx context.Context, repoID int64, opts db.ListOptions) ([]*user_model.User, error)
- func GetRepoWatchersIDs(ctx context.Context, repoID int64) ([]int64, error)
- func GetRepositoriesMapByIDs(ctx context.Context, ids []int64) (map[int64]*Repository, error)
- func GetStargazers(ctx context.Context, repo *Repository, opts db.ListOptions) ([]*user_model.User, error)
- func GetTagNamesByRepoID(ctx context.Context, repoID int64) ([]string, error)
- func GetUnindexedRepos(ctx context.Context, indexerType RepoIndexerType, maxRepoID int64, ...) ([]int64, error)
- func GetWikiIndexCount(ctx context.Context, repoID int64) (int64, error)
- func GetWikiTotalWordCount(ctx context.Context, repoID int64) (int64, error)
- func HasForkedRepo(ctx context.Context, ownerID, repoID int64) bool
- func IncrementRepoForkNum(ctx context.Context, repoID int64) error
- func InsertMirror(ctx context.Context, mirror *Mirror) error
- func InsertReleases(ctx context.Context, rels ...*Release) error
- func IsCollaborator(ctx context.Context, repoID, userID int64) (bool, error)
- func IsErrAttachmentNotExist(err error) bool
- func IsErrNoPendingTransfer(err error) bool
- func IsErrPagesConfigNotExist(err error) bool
- func IsErrPagesDomainAlreadyExist(err error) bool
- func IsErrPagesDomainNotExist(err error) bool
- func IsErrReachLimitOfRepo(err error) bool
- func IsErrRedirectNotExist(err error) bool
- func IsErrReleaseAlreadyExist(err error) bool
- func IsErrReleaseNotExist(err error) bool
- func IsErrRepoAlreadyExist(err error) bool
- func IsErrRepoFilesAlreadyExist(err error) bool
- func IsErrRepoNotExist(err error) bool
- func IsErrRepoTransferInProgress(err error) bool
- func IsErrTopicNotExist(err error) bool
- func IsErrUnitTypeNotExist(err error) bool
- func IsErrUploadNotExist(err error) bool
- func IsErrUploadSessionExpired(err error) bool
- func IsErrUploadSessionNotExist(err error) bool
- func IsErrUserDoesNotHaveAccessToRepo(err error) bool
- func IsErrUserOwnRepos(err error) bool
- func IsErrWikiAlreadyExist(err error) bool
- func IsErrWikiInvalidFileName(err error) bool
- func IsErrWikiReservedName(err error) bool
- func IsOwnerMemberCollaborator(ctx context.Context, repo *Repository, userID int64) (bool, error)
- func IsPagesEnabled(ctx context.Context, repoID int64) (bool, error)
- func IsReleaseExist(ctx context.Context, repoID int64, tagName string) (bool, error)
- func IsRepositoryModelExist(ctx context.Context, u *user_model.User, repoName string) (bool, error)
- func IsRepositoryTransferExist(ctx context.Context, repoID int64) (bool, error)
- func IsStaring(ctx context.Context, userID, repoID int64) bool
- func IsUsableRepoName(name string) error
- func IsValidSSHAccessRepoName(name string) bool
- func IsWatchMode(mode WatchMode) bool
- func IsWatching(ctx context.Context, userID, repoID int64) bool
- func LookupRedirect(ctx context.Context, ownerID int64, repoName string) (int64, error)
- func MirrorsIterate(ctx context.Context, limit int, f func(idx int, bean any) error) error
- func NewRedirect(ctx context.Context, ownerID, repoID int64, oldRepoName, newRepoName string) error
- func PushMirrorsIterate(ctx context.Context, limit int, f func(idx int, bean any) error) error
- func PushUpdateDeleteTags(ctx context.Context, repo *Repository, tags []string) error
- func RelativePath(ownerName, repoName string) string
- func RelativeWikiPath(ownerName, repoName string) string
- func RemoveTopicsFromRepo(ctx context.Context, repoID int64) error
- func RepoPath(userName, repoName string) string
- func SanitizeAndValidateTopics(topics []string) (validTopics, invalidTopics []string)
- func SaveTopics(ctx context.Context, repoID int64, topicNames ...string) error
- func SearchRepositoryCondition(opts SearchRepoOptions) builder.Cond
- func SearchRepositoryIDs(ctx context.Context, opts SearchRepoOptions) ([]int64, int64, error)
- func SearchRepositoryIDsByCondition(ctx context.Context, cond builder.Cond) ([]int64, error)
- func SetArchiveRepoState(ctx context.Context, repo *Repository, isArchived bool) (err error)
- func StarRepo(ctx context.Context, doer *user_model.User, repo *Repository, star bool) error
- func TestRepositoryReadyForTransfer(status RepositoryStatus) error
- func TouchMirror(ctx context.Context, m *Mirror) error
- func UpdateAttachment(ctx context.Context, atta *Attachment) error
- func UpdateAttachmentByUUID(ctx context.Context, attach *Attachment, cols ...string) error
- func UpdateDefaultBranch(ctx context.Context, repo *Repository) error
- func UpdateIndexerStatus(ctx context.Context, repo *Repository, indexerType RepoIndexerType, sha string) error
- func UpdateLanguageStats(ctx context.Context, repo *Repository, commitID string, stats map[string]int64) error
- func UpdateMirror(ctx context.Context, m *Mirror) error
- func UpdatePagesConfig(ctx context.Context, config *PagesConfig) error
- func UpdatePagesDomain(ctx context.Context, domain *PagesDomain) error
- func UpdatePushMirror(ctx context.Context, m *PushMirror) error
- func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error
- func UpdateRelease(ctx context.Context, rel *Release) error
- func UpdateReleaseNumCommits(ctx context.Context, rel *Release) error
- func UpdateReleasesMigrationsByType(ctx context.Context, gitServiceType structs.GitServiceType, ...) error
- func UpdateRepoArchiverStatus(ctx context.Context, archiver *RepoArchiver) error
- func UpdateRepoIssueNumbers(ctx context.Context, repoID int64, isPull, isClosed bool) error
- func UpdateRepoLicenses(ctx context.Context, repo *Repository, commitID string, licenses []string) error
- func UpdateRepoSize(ctx context.Context, repoID, gitSize, lfsSize int64) error
- func UpdateRepoUnit(ctx context.Context, unit *RepoUnit) error
- func UpdateRepoUnitPublicAccess(ctx context.Context, unit *RepoUnit) error
- func UpdateRepositoryColsNoAutoTime(ctx context.Context, repo *Repository, colName string, moreColNames ...string) error
- func UpdateRepositoryColsWithAutoTime(ctx context.Context, repo *Repository, colName string, moreColNames ...string) error
- func UpdateRepositoryOwnerName(ctx context.Context, oldUserName, newUserName string) error
- func UpdateRepositoryOwnerNames(ctx context.Context, ownerID int64, ownerName string) error
- func UpdateRepositoryUpdatedTime(ctx context.Context, repoID int64, updateTime time.Time) error
- func UpdateUploadSession(ctx context.Context, session *UploadSession) error
- func UpdateUploadSessionChunks(ctx context.Context, session *UploadSession) error
- func UploadSessionTempPath(uuid string) string
- func UserAccessRepoCond(idStr string, userID int64) builder.Cond
- func UserAssignedRepoCond(id string, userID int64) builder.Cond
- func UserCollaborationRepoCond(idStr string, userID int64) builder.Cond
- func UserCreateIssueRepoCond(id string, userID int64, isPull bool) builder.Cond
- func UserMentionedRepoCond(id string, userID int64) builder.Cond
- func UserOrgPublicUnitRepoCond(userID, orgID int64) builder.Cond
- func UserOrgTeamRepoCond(idStr string, userID int64) builder.Cond
- func UserOrgUnitRepoCond(idStr string, userID, orgID int64, unitType unit.Type) builder.Cond
- func UserOwnedRepoCond(userID int64) builder.Cond
- func ValidateTopic(topic string) bool
- func VerifyPagesDomain(ctx context.Context, id int64) error
- func WatchIfAuto(ctx context.Context, userID, repoID int64, isWrite bool) error
- func WatchRepo(ctx context.Context, doer *user_model.User, repo *Repository, doWatch bool) error
- type AccessibleReposEnvironment
- type ActionsConfig
- func (cfg *ActionsConfig) AddCollaborativeOwner(ownerID int64)
- func (cfg *ActionsConfig) DisableWorkflow(file string)
- func (cfg *ActionsConfig) EnableWorkflow(file string)
- func (cfg *ActionsConfig) FromDB(bs []byte) error
- func (cfg *ActionsConfig) IsCollaborativeOwner(ownerID int64) bool
- func (cfg *ActionsConfig) IsWorkflowDisabled(file string) bool
- func (cfg *ActionsConfig) RemoveCollaborativeOwner(ownerID int64)
- func (cfg *ActionsConfig) ToDB() ([]byte, error)
- func (cfg *ActionsConfig) ToString() string
- type ArchiveType
- type ArchiverStatus
- type Attachment
- func GetAttachmentByID(ctx context.Context, id int64) (*Attachment, error)
- func GetAttachmentByReleaseIDFileName(ctx context.Context, releaseID int64, fileName string) (*Attachment, error)
- func GetAttachmentByUUID(ctx context.Context, uuid string) (*Attachment, error)
- func GetAttachmentsByCommentID(ctx context.Context, commentID int64) ([]*Attachment, error)
- func GetAttachmentsByIssueID(ctx context.Context, issueID int64) ([]*Attachment, error)
- func GetAttachmentsByIssueIDImagesLatest(ctx context.Context, issueID int64) ([]*Attachment, error)
- func GetAttachmentsByUUIDs(ctx context.Context, uuids []string) ([]*Attachment, error)
- type CloneLink
- type Collaboration
- type Collaborator
- type CountRepositoryOptions
- type ErrAttachmentNotExist
- type ErrNoPendingRepoTransfer
- type ErrPagesConfigNotExist
- type ErrPagesDomainAlreadyExist
- type ErrPagesDomainNotExist
- type ErrReachLimitOfRepo
- type ErrRedirectNotExist
- type ErrReleaseAlreadyExist
- type ErrReleaseNotExist
- type ErrRepoAlreadyExist
- type ErrRepoFilesAlreadyExist
- type ErrRepoIsArchived
- type ErrRepoNotExist
- type ErrRepoTransferInProgress
- type ErrTopicNotExist
- type ErrUnitTypeNotExist
- type ErrUploadNotExist
- type ErrUploadSessionExpired
- type ErrUploadSessionNotExist
- type ErrUserDoesNotHaveAccessToRepo
- type ErrUserOwnRepos
- type ErrWikiAlreadyExist
- type ErrWikiInvalidFileName
- type ErrWikiReservedName
- type ExternalTrackerConfig
- type ExternalWikiConfig
- type FindCollaborationOptions
- type FindReleasesOptions
- type FindRepoArchiversOption
- type FindTopicOptions
- type IssuesConfig
- type LanguageStat
- type LanguageStatList
- type MergeStyle
- type Mirror
- type PagesConfig
- type PagesDomain
- func GetPagesDomainByDomain(ctx context.Context, domainName string) (*PagesDomain, error)
- func GetPagesDomainByID(ctx context.Context, id int64) (*PagesDomain, error)
- func GetPagesDomains(ctx context.Context, repoID int64) ([]*PagesDomain, error)
- func GetPagesDomainsByRepoID(ctx context.Context, repoID int64) ([]*PagesDomain, error)
- type PagesTemplate
- type PendingRepositoryTransferOptions
- type ProjectsConfig
- type ProjectsMode
- type PullRequestsConfig
- type PushMirror
- func GetPushMirrorByIDAndRepoID(ctx context.Context, id, repoID int64) (*PushMirror, bool, error)
- func GetPushMirrorsByRepoID(ctx context.Context, repoID int64, listOptions db.ListOptions) ([]*PushMirror, int64, error)
- func GetPushMirrorsSyncedOnCommit(ctx context.Context, repoID int64) ([]*PushMirror, error)
- type PushMirrorOptions
- type Redirect
- type Release
- func GetLatestReleaseByRepoID(ctx context.Context, repoID int64) (*Release, error)
- func GetRelease(ctx context.Context, repoID int64, tagName string) (*Release, error)
- func GetReleaseByID(ctx context.Context, id int64) (*Release, error)
- func GetReleaseForRepoByID(ctx context.Context, repoID, id int64) (*Release, error)
- func (r *Release) APIURL() string
- func (r *Release) APIUploadURL() string
- func (r *Release) GetExternalID() int64
- func (r *Release) GetExternalName() string
- func (r *Release) GetUserID() int64
- func (r *Release) HTMLURL() string
- func (r *Release) Link() string
- func (r *Release) LoadAttributes(ctx context.Context) error
- func (r *Release) RemapExternalUser(externalName string, externalID, userID int64) error
- func (r *Release) TarURL() string
- func (r *Release) ZipURL() string
- type RepoArchiver
- type RepoIndexerStatus
- type RepoIndexerType
- type RepoLicense
- type RepoLicenseList
- type RepoTopic
- type RepoTransfer
- type RepoUnit
- func (r *RepoUnit) ActionsConfig() *ActionsConfig
- func (r *RepoUnit) BeforeSet(colName string, val xorm.Cell)
- func (r *RepoUnit) CodeConfig() *UnitConfig
- func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig
- func (r *RepoUnit) ExternalWikiConfig() *ExternalWikiConfig
- func (r *RepoUnit) IssuesConfig() *IssuesConfig
- func (r *RepoUnit) ProjectsConfig() *ProjectsConfig
- func (r *RepoUnit) PullRequestsConfig() *PullRequestsConfig
- func (r *RepoUnit) ReleasesConfig() *UnitConfig
- func (r *RepoUnit) Unit() unit.Unit
- type Repository
- func FindUserOrgForks(ctx context.Context, repoID, userID int64) ([]*Repository, error)
- func GetForkedRepo(ctx context.Context, ownerID, repoID int64) *Repository
- func GetForksByUserAndOrgs(ctx context.Context, user *user_model.User, repo *Repository) ([]*Repository, error)
- func GetRepositoriesByForkID(ctx context.Context, forkID int64) ([]*Repository, error)
- func GetRepositoryByID(ctx context.Context, id int64) (*Repository, error)
- func GetRepositoryByName(ctx context.Context, ownerID int64, name string) (*Repository, error)
- func GetRepositoryByOwnerAndName(ctx context.Context, ownerName, repoName string) (*Repository, error)
- func GetRepositoryByURL(ctx context.Context, repoURL string) (*Repository, error)
- func GetRepositoryByURLRelax(ctx context.Context, repoURL string) (*Repository, error)
- func GetStarredRepos(ctx context.Context, opts *StarredReposOptions) ([]*Repository, error)
- func GetTemplateRepo(ctx context.Context, repo *Repository) (*Repository, error)
- func GetUserFork(ctx context.Context, repoID, userID int64) (*Repository, error)
- func GetWatchedRepos(ctx context.Context, opts *WatchedReposOptions) ([]*Repository, int64, error)
- func ValuesRepository(m map[int64]*Repository) []*Repository
- func (repo *Repository) APIURL() string
- func (repo *Repository) AfterLoad()
- func (repo *Repository) AllowOnlyContributorsToTrackTime(ctx context.Context) bool
- func (repo *Repository) AllowsPulls(ctx context.Context) bool
- func (repo *Repository) AvatarLink(ctx context.Context) string
- func (repo *Repository) CanContentChange() bool
- func (repo *Repository) CanCreateBranch() bool
- func (repo *Repository) CanEnableEditor() bool
- func (repo *Repository) CanEnablePulls() bool
- func (repo *Repository) CanEnableTimetracker() bool
- func (repo *Repository) CloneLink(ctx context.Context, doer *user_model.User) (cl *CloneLink)
- func (repo *Repository) CloneLinkGeneral(ctx context.Context) (cl *CloneLink)
- func (repo *Repository) CommitLink(commitID string) (result string)
- func (repo *Repository) ComposeBranchCompareURL(baseRepo *Repository, branchName string) string
- func (repo *Repository) ComposeCommentMetas(ctx context.Context) map[string]string
- func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string
- func (repo *Repository) ComposeRepoFileMetas(ctx context.Context) map[string]string
- func (repo *Repository) ComposeWikiMetas(ctx context.Context) map[string]string
- func (repo *Repository) CustomAvatarRelativePath() string
- func (repo *Repository) DescriptionHTML(ctx context.Context) template.HTML
- func (repo *Repository) FullName() string
- func (repo *Repository) GetBaseRepo(ctx context.Context) (err error)
- func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string
- func (repo *Repository) GetOriginalURLHostname() string
- func (repo *Repository) GetTrustModel() TrustModelType
- func (repo *Repository) GetUnit(ctx context.Context, tp unit.Type) (*RepoUnit, error)
- func (repo *Repository) HTMLURL(ctxs ...context.Context) string
- func (repo *Repository) IsBeingCreated() bool
- func (repo *Repository) IsBeingMigrated() bool
- func (repo *Repository) IsBroken() bool
- func (repo *Repository) IsDependenciesEnabled(ctx context.Context) bool
- func (repo *Repository) IsGenerated() bool
- func (repo *Repository) IsOwnedBy(userID int64) bool
- func (repo *Repository) IsTimetrackerEnabled(ctx context.Context) bool
- func (repo *Repository) Link() string
- func (repo *Repository) LoadAttributes(ctx context.Context) error
- func (repo *Repository) LoadOwner(ctx context.Context) (err error)
- func (repo *Repository) LoadUnits(ctx context.Context) (err error)
- func (repo *Repository) LogString() string
- func (repo *Repository) MarkAsBrokenEmpty()
- func (repo *Repository) MustGetUnit(ctx context.Context, tp unit.Type) *RepoUnit
- func (repo *Repository) MustNotBeArchived() error
- func (repo *Repository) MustOwner(ctx context.Context) *user_model.User
- func (repo *Repository) RelAvatarLink(ctx context.Context) string
- func (repo *Repository) RelativePath() string
- func (repo *Repository) RepoPath() string
- func (repo *Repository) SanitizedOriginalURL() string
- func (repo *Repository) SizeDetails() []SizeDetail
- func (repo *Repository) SizeDetailsString() string
- func (repo *Repository) TemplateRepo(ctx context.Context) *Repository
- func (repo *Repository) UnitEnabled(ctx context.Context, tp unit.Type) bool
- func (repo *Repository) WikiCloneLink(ctx context.Context, doer *user_model.User) *CloneLink
- func (repo *Repository) WikiStorageRepo() StorageRepo
- type RepositoryList
- func GetOrgRepositories(ctx context.Context, orgID int64) (RepositoryList, error)
- func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (RepositoryList, error)
- func GetUserRepositories(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
- func RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList
- func SearchRepository(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
- func SearchRepositoryByCondition(ctx context.Context, opts SearchRepoOptions, cond builder.Cond, ...) (RepositoryList, int64, error)
- func SearchRepositoryByName(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
- func (repos RepositoryList) IDs() []int64
- func (repos RepositoryList) Len() int
- func (repos RepositoryList) Less(i, j int) bool
- func (repos RepositoryList) LoadAttributes(ctx context.Context) error
- func (repos RepositoryList) LoadLanguageStats(ctx context.Context) error
- func (repos RepositoryList) LoadOwners(ctx context.Context) error
- func (repos RepositoryList) LoadUnits(ctx context.Context) error
- func (repos RepositoryList) Swap(i, j int)
- type RepositoryStatus
- type SSLStatus
- type SearchRepoOptions
- type SearchTeamRepoOptions
- type SearchWikiOptions
- type SizeDetail
- type Star
- type StarredReposOptions
- type StorageRepo
- type Topic
- func AddTopic(ctx context.Context, repoID int64, topicName string) (*Topic, error)
- func DeleteTopic(ctx context.Context, repoID int64, topicName string) (*Topic, error)
- func GetRepoTopicByName(ctx context.Context, repoID int64, topicName string) (*Topic, error)
- func GetTopicByName(ctx context.Context, name string) (*Topic, error)
- type TrustModelType
- type UnitConfig
- type Upload
- type UploadSession
- func GetActiveUploadSessionsForRelease(ctx context.Context, releaseID int64) ([]*UploadSession, error)
- func GetExpiredUploadSessions(ctx context.Context) ([]*UploadSession, error)
- func GetUploadSessionByID(ctx context.Context, id int64) (*UploadSession, error)
- func GetUploadSessionByUUID(ctx context.Context, uuid string) (*UploadSession, error)
- func GetUploadSessionsForUser(ctx context.Context, userID int64) ([]*UploadSession, error)
- type UploadSessionStatus
- type Watch
- type WatchMode
- type WatchedReposOptions
- type WikiIndex
Constants ¶
const ( ArchiverGenerating = iota // the archiver is generating ArchiverReady // it's ready )
enumerate all repo archive statuses
const ( SizeDetailNameGit = "git" SizeDetailNameLFS = "lfs" )
text representations to be returned in SizeDetail.Name
const DefaultChunkSize = 10 * 1024 * 1024
DefaultChunkSize is 10MB
DefaultSessionExpiry is 24 hours
const RepositoryListDefaultPageSize = 64
RepositoryListDefaultPageSize is the default number of repositories to load in memory when running administrative tasks on all (or almost all) of them. The number should be low enough to avoid filling up all RAM with repository data...
Variables ¶
var ErrMirrorNotExist = util.NewNotExistErrorf("Mirror does not exist")
ErrMirrorNotExist mirror does not exist error
var OrderByFlatMap = map[string]db.SearchOrderBy{ "newest": OrderByMap["desc"]["created"], "oldest": OrderByMap["asc"]["created"], "recentupdate": OrderByMap["desc"]["updated"], "leastupdate": OrderByMap["asc"]["updated"], "reversealphabetically": OrderByMap["desc"]["alpha"], "alphabetically": OrderByMap["asc"]["alpha"], "reversesize": OrderByMap["desc"]["size"], "size": OrderByMap["asc"]["size"], "reversegitsize": OrderByMap["desc"]["git_size"], "gitsize": OrderByMap["asc"]["git_size"], "reverselfssize": OrderByMap["desc"]["lfs_size"], "lfssize": OrderByMap["asc"]["lfs_size"], "moststars": OrderByMap["desc"]["stars"], "feweststars": OrderByMap["asc"]["stars"], "mostforks": OrderByMap["desc"]["forks"], "fewestforks": OrderByMap["asc"]["forks"], }
OrderByFlatMap is similar to OrderByMap but use human language keywords to decide between asc and desc
var OrderByMap = map[string]map[string]db.SearchOrderBy{ "asc": { "alpha": "owner_name ASC, name ASC", "created": db.SearchOrderByOldest, "updated": db.SearchOrderByLeastUpdated, "size": "size ASC", "git_size": "git_size ASC", "lfs_size": "lfs_size ASC", "id": db.SearchOrderByID, "stars": db.SearchOrderByStars, "forks": db.SearchOrderByForks, }, "desc": { "alpha": "owner_name DESC, name DESC", "created": db.SearchOrderByNewest, "updated": db.SearchOrderByRecentUpdated, "size": "size DESC", "git_size": "git_size DESC", "lfs_size": "lfs_size DESC", "id": db.SearchOrderByIDReverse, "stars": db.SearchOrderByStarsReverse, "forks": db.SearchOrderByForksReverse, }, }
OrderByMap represents all possible search order
Functions ¶
func AccessibleRepoIDsQuery ¶
func AccessibleRepoIDsQuery(user *user_model.User) *builder.Builder
AccessibleRepoIDsQuery queries accessible repository ids. Usable as a subquery wherever repo ids need to be filtered.
func AccessibleRepositoryCondition ¶
AccessibleRepositoryCondition takes a user a returns a condition for checking if a repository is accessible
func ActivatePagesDomainSSL ¶
ActivatePagesDomainSSL sets SSL status to active for a domain
func AddReleaseAttachments ¶
func AddReleaseAttachments(ctx context.Context, releaseID int64, attachmentUUIDs []string) (err error)
AddReleaseAttachments adds a release attachments
func AttachmentRelativePath ¶
AttachmentRelativePath returns the relative path
func ChangeCollaborationAccessMode ¶
func ChangeCollaborationAccessMode(ctx context.Context, repo *Repository, uid int64, mode perm.AccessMode) error
ChangeCollaborationAccessMode sets new access mode for the collaboration.
func CleanRepoLicenses ¶
func CleanRepoLicenses(ctx context.Context, repo *Repository) error
CleanRepoLicenses will remove all license record of the repo
func ClearRepoStars ¶
ClearRepoStars clears all stars for a repository and from the user that starred it. Used when a repository is set to private.
func ComposeHTTPSCloneURL ¶
ComposeHTTPSCloneURL returns HTTPS clone URL based on the given owner and repository name.
func ComposeSSHCloneURL ¶
func ComposeSSHCloneURL(doer *user_model.User, ownerName, repoName string) string
ComposeSSHCloneURL returns SSH clone URL based on the given owner and repository name.
func ComposeTeaCloneCommand ¶
ComposeTeaCloneCommand returns Tea CLI clone command based on the given owner and repository name.
func CopyLanguageStat ¶
func CopyLanguageStat(ctx context.Context, originalRepo, destRepo *Repository) error
CopyLanguageStat Copy originalRepo language stat information to destRepo (use for forked repo)
func CopyLicense ¶
func CopyLicense(ctx context.Context, originalRepo, destRepo *Repository) error
CopyLicense Copy originalRepo license information to destRepo (use for forked repo)
func CountNullArchivedRepository ¶
CountNullArchivedRepository counts the number of repositories with is_archived is null
func CountOrgRepoStars ¶
CountOrgRepoStars returns the total number of stars across all repos owned by an organization
func CountOrphanedAttachments ¶
CountOrphanedAttachments returns the number of bad attachments
func CountOrphanedTopics ¶
CountOrphanedAttachments returns the number of topics that don't belong to any repository.
func CountRepositories ¶
func CountRepositories(ctx context.Context, opts CountRepositoryOptions) (int64, error)
CountRepositories returns number of repositories. Argument private only takes effect when it is false, set it true to count all repositories.
func CountRepository ¶
func CountRepository(ctx context.Context, opts SearchRepoOptions) (int64, error)
CountRepository counts repositories based on search options,
func CreateOrUpdateWikiIndex ¶
CreateOrUpdateWikiIndex creates or updates a wiki index entry
func CreatePagesConfig ¶
func CreatePagesConfig(ctx context.Context, config *PagesConfig) error
CreatePagesConfig creates a new pages config for a repository
func CreatePagesDomain ¶
func CreatePagesDomain(ctx context.Context, domain *PagesDomain) error
CreatePagesDomain creates a new custom domain for pages
func CreatePendingRepositoryTransfer ¶
func CreatePendingRepositoryTransfer(ctx context.Context, doer, newOwner *user_model.User, repoID int64, teams []*organization.Team) error
CreatePendingRepositoryTransfer transfer a repo from one owner to a new one. it marks the repository transfer as "pending"
func CreateUploadSession ¶
func CreateUploadSession(ctx context.Context, session *UploadSession) error
CreateUploadSession creates a new upload session
func DecrementRepoForkNum ¶
DecrementRepoForkNum decrement repository fork number
func DeleteAllRepoArchives ¶
DeleteAllRepoArchives deletes all repo archives records
func DeleteAttachment ¶
func DeleteAttachment(ctx context.Context, a *Attachment, remove bool) error
DeleteAttachment deletes the given attachment and optionally the associated file.
func DeleteAttachments ¶
DeleteAttachments deletes the given attachments and optionally the associated files.
func DeleteAttachmentsByComment ¶
DeleteAttachmentsByComment deletes all attachments associated with the given comment.
func DeleteAttachmentsByIssue ¶
DeleteAttachmentsByIssue deletes all attachments associated with the given issue.
func DeleteAttachmentsByRelease ¶
DeleteAttachmentsByRelease deletes all attachments associated with the given release.
func DeleteExpiredUploadSessions ¶
DeleteExpiredUploadSessions deletes all expired upload sessions
func DeleteMirrorByRepoID ¶
DeleteMirrorByRepoID deletes a mirror by repoID
func DeleteOrphanedAttachments ¶
DeleteOrphanedAttachments delete all bad attachments
func DeleteOrphanedTopics ¶
DeleteOrphanedAttachments delete all topics that don't belong to any repository.
func DeletePagesConfig ¶
DeletePagesConfig deletes a pages config
func DeletePagesDomain ¶
DeletePagesDomain deletes a pages domain
func DeletePagesDomainsByRepoID ¶
DeletePagesDomainsByRepoID deletes all pages domains for a repository
func DeletePushMirrors ¶
func DeletePushMirrors(ctx context.Context, opts PushMirrorOptions) error
func DeleteRedirect ¶
DeleteRedirect delete any redirect from the specified repo name to anything else
func DeleteRepositoryTransfer ¶
func DeleteUploadByUUID ¶
DeleteUploadByUUID deletes a upload by UUID
func DeleteUploadSession ¶
func DeleteUploadSession(ctx context.Context, session *UploadSession) error
DeleteUploadSession deletes an upload session and its temp files
func DeleteUploadSessionByUUID ¶
DeleteUploadSessionByUUID deletes an upload session by UUID
func DeleteUploads ¶
DeleteUploads deletes multiple uploads
func DeleteWikiIndex ¶
DeleteWikiIndex deletes a wiki index entry
func DeleteWikiIndexByRepo ¶
DeleteWikiIndexByRepo deletes all wiki indexes for a repository
func DisablePages ¶
DisablePages disables pages for a repository
func EnablePages ¶
func EnablePages(ctx context.Context, repoID int64, template PagesTemplate) error
EnablePages enables pages for a repository
func ExistAttachmentsByUUID ¶
ExistAttachmentsByUUID returns true if attachment exists with the given UUID
func ExistsRepoArchiverWithStoragePath ¶
ExistsRepoArchiverWithStoragePath checks if there is a RepoArchiver for a given storage path
func ExistsWithAvatarAtStoragePath ¶
ExistsWithAvatarAtStoragePath returns true if there is a user with this Avatar
func FindTagsByCommitIDs ¶
func FindUserCodeAccessibleOwnerRepoIDs ¶
func FindUserCodeAccessibleOwnerRepoIDs(ctx context.Context, ownerID int64, user *user_model.User) ([]int64, error)
FindUserCodeAccessibleOwnerRepoIDs finds all repository IDs for the given owner whose code the user can see.
func FindUserCodeAccessibleRepoIDs ¶
FindUserCodeAccessibleRepoIDs finds all at Code level accessible repositories' ID by the user's id
func FixNullArchivedRepository ¶
FixNullArchivedRepository sets is_archived to false where it is null
func GenerateTopics ¶
func GenerateTopics(ctx context.Context, templateRepo, generateRepo *Repository) error
GenerateTopics generates topics from a template repository
func GenerateVerificationToken ¶
GenerateVerificationToken generates a random token for domain verification
func GetIssuePostersWithSearch ¶
func GetIssuePostersWithSearch(ctx context.Context, repo *Repository, isPull bool, search string, isShowFullName bool) ([]*user_model.User, error)
GetIssuePostersWithSearch returns users with limit of 30 whose username started with prefix that have authored an issue/pull request for the given repository If isShowFullName is set to true, also include full name prefix search
func GetReleaseAttachments ¶
GetReleaseAttachments retrieves the attachments for releases
func GetRepoAssignees ¶
func GetRepoAssignees(ctx context.Context, repo *Repository) (_ []*user_model.User, err error)
GetRepoAssignees returns all users that have write access and can be assigned to issues of the repository,
func GetRepoWatchers ¶
func GetRepoWatchers(ctx context.Context, repoID int64, opts db.ListOptions) ([]*user_model.User, error)
GetRepoWatchers returns range of users watching given repository.
func GetRepoWatchersIDs ¶
GetRepoWatchersIDs returns IDs of watchers for a given repo ID but avoids joining with `user` for performance reasons User permissions must be verified elsewhere if required
func GetRepositoriesMapByIDs ¶
GetRepositoriesMapByIDs returns the repositories by given id slice.
func GetStargazers ¶
func GetStargazers(ctx context.Context, repo *Repository, opts db.ListOptions) ([]*user_model.User, error)
GetStargazers returns the users that starred the repo.
func GetTagNamesByRepoID ¶
GetTagNamesByRepoID returns a list of release tag names of repository.
func GetUnindexedRepos ¶
func GetUnindexedRepos(ctx context.Context, indexerType RepoIndexerType, maxRepoID int64, page, pageSize int) ([]int64, error)
GetUnindexedRepos returns repos which do not have an indexer status
func GetWikiIndexCount ¶
GetWikiIndexCount returns the number of indexed pages for a repository
func GetWikiTotalWordCount ¶
GetWikiTotalWordCount returns the total word count for a repository's wiki
func HasForkedRepo ¶
HasForkedRepo checks if given user has already forked a repository with given ID.
func IncrementRepoForkNum ¶
IncrementRepoForkNum increment repository fork number
func InsertMirror ¶
InsertMirror inserts a mirror to database
func InsertReleases ¶
InsertReleases migrates release
func IsCollaborator ¶
IsCollaborator check if a user is a collaborator of a repository
func IsErrAttachmentNotExist ¶
IsErrAttachmentNotExist checks if an error is a ErrAttachmentNotExist.
func IsErrNoPendingTransfer ¶
IsErrNoPendingTransfer is an error type when a repository has no pending transfers
func IsErrPagesConfigNotExist ¶
IsErrPagesConfigNotExist checks if an error is ErrPagesConfigNotExist
func IsErrPagesDomainAlreadyExist ¶
IsErrPagesDomainAlreadyExist checks if an error is ErrPagesDomainAlreadyExist
func IsErrPagesDomainNotExist ¶
IsErrPagesDomainNotExist checks if an error is ErrPagesDomainNotExist
func IsErrReachLimitOfRepo ¶
IsErrReachLimitOfRepo checks if an error is a ErrReachLimitOfRepo.
func IsErrRedirectNotExist ¶
IsErrRedirectNotExist check if an error is an ErrRepoRedirectNotExist.
func IsErrReleaseAlreadyExist ¶
IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.
func IsErrReleaseNotExist ¶
IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.
func IsErrRepoAlreadyExist ¶
IsErrRepoAlreadyExist checks if an error is a ErrRepoAlreadyExist.
func IsErrRepoFilesAlreadyExist ¶
IsErrRepoFilesAlreadyExist checks if an error is a ErrRepoAlreadyExist.
func IsErrRepoNotExist ¶
IsErrRepoNotExist checks if an error is a ErrRepoNotExist.
func IsErrRepoTransferInProgress ¶
IsErrRepoTransferInProgress checks if an error is a ErrRepoTransferInProgress.
func IsErrTopicNotExist ¶
IsErrTopicNotExist checks if an error is an ErrTopicNotExist.
func IsErrUnitTypeNotExist ¶
IsErrUnitTypeNotExist checks if an error is a ErrUnitNotExist.
func IsErrUploadNotExist ¶
IsErrUploadNotExist checks if an error is a ErrUploadNotExist.
func IsErrUploadSessionNotExist ¶
IsErrUploadSessionNotExist checks if an error is a ErrUploadSessionNotExist.
func IsErrUserDoesNotHaveAccessToRepo ¶
IsErrUserDoesNotHaveAccessToRepo checks if an error is a ErrUserDoesNotHaveAccessToRepo.
func IsErrUserOwnRepos ¶
IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.
func IsErrWikiAlreadyExist ¶
IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.
func IsErrWikiInvalidFileName ¶
IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.
func IsErrWikiReservedName ¶
IsErrWikiReservedName checks if an error is an ErrWikiReservedName.
func IsOwnerMemberCollaborator ¶
IsOwnerMemberCollaborator checks if a provided user is the owner, a collaborator or a member of a team in a repository
func IsPagesEnabled ¶
IsPagesEnabled checks if pages is enabled for a repository
func IsReleaseExist ¶
IsReleaseExist returns true if release with given tag name already exists.
func IsRepositoryModelExist ¶
func IsRepositoryTransferExist ¶
func IsStaring ¶
IsStaring checks if user has starred given repository.
func IsUsableRepoName ¶
IsUsableRepoName returns true when name is usable
func IsValidSSHAccessRepoName ¶
IsValidSSHAccessRepoName is like IsUsableRepoName, but it allows "*.wiki" because wiki repo needs to be accessed in SSH code
func IsWatchMode ¶
IsWatchMode Decodes watchability of WatchMode
func IsWatching ¶
IsWatching checks if user has watched given repository.
func LookupRedirect ¶
LookupRedirect look up if a repository has a redirect name
func MirrorsIterate ¶
MirrorsIterate iterates all mirror repositories.
func NewRedirect ¶
NewRedirect create a new repo redirect
func PushMirrorsIterate ¶
PushMirrorsIterate iterates all push-mirror repositories.
func PushUpdateDeleteTags ¶
func PushUpdateDeleteTags(ctx context.Context, repo *Repository, tags []string) error
PushUpdateDeleteTags updates a number of delete tags with context
func RemoveTopicsFromRepo ¶
RemoveTopicsFromRepo remove all topics from the repo and decrements respective topics repo count
func RepoPath ¶
RepoPath returns repository path by given user and repository name.
func SanitizeAndValidateTopics ¶
SanitizeAndValidateTopics sanitizes and checks an array or topics
func SaveTopics ¶
SaveTopics save topics to a repository
func SearchRepositoryCondition ¶
func SearchRepositoryCondition(opts SearchRepoOptions) builder.Cond
SearchRepositoryCondition creates a query condition according search repository options
func SearchRepositoryIDs ¶
SearchRepositoryIDs takes keyword and part of repository name to search, it returns results in given range and number of total results.
func SearchRepositoryIDsByCondition ¶
SearchRepositoryIDsByCondition search repository IDs by given condition.
func SetArchiveRepoState ¶
func SetArchiveRepoState(ctx context.Context, repo *Repository, isArchived bool) (err error)
SetArchiveRepoState sets if a repo is archived
func StarRepo ¶
func StarRepo(ctx context.Context, doer *user_model.User, repo *Repository, star bool) error
StarRepo or unstar repository.
func TestRepositoryReadyForTransfer ¶
func TestRepositoryReadyForTransfer(status RepositoryStatus) error
TestRepositoryReadyForTransfer make sure repo is ready to transfer
func TouchMirror ¶
TouchMirror updates the mirror updatedUnix
func UpdateAttachment ¶
func UpdateAttachment(ctx context.Context, atta *Attachment) error
UpdateAttachment updates the given attachment in database
func UpdateAttachmentByUUID ¶
func UpdateAttachmentByUUID(ctx context.Context, attach *Attachment, cols ...string) error
UpdateAttachmentByUUID Updates attachment via uuid
func UpdateDefaultBranch ¶
func UpdateDefaultBranch(ctx context.Context, repo *Repository) error
UpdateDefaultBranch updates the default branch
func UpdateIndexerStatus ¶
func UpdateIndexerStatus(ctx context.Context, repo *Repository, indexerType RepoIndexerType, sha string) error
UpdateIndexerStatus updates indexer status
func UpdateLanguageStats ¶
func UpdateLanguageStats(ctx context.Context, repo *Repository, commitID string, stats map[string]int64) error
UpdateLanguageStats updates the language statistics for repository
func UpdateMirror ¶
UpdateMirror updates the mirror
func UpdatePagesConfig ¶
func UpdatePagesConfig(ctx context.Context, config *PagesConfig) error
UpdatePagesConfig updates a pages config
func UpdatePagesDomain ¶
func UpdatePagesDomain(ctx context.Context, domain *PagesDomain) error
UpdatePagesDomain updates a pages domain
func UpdatePushMirror ¶
func UpdatePushMirror(ctx context.Context, m *PushMirror) error
UpdatePushMirror updates the push-mirror
func UpdatePushMirrorInterval ¶
func UpdatePushMirrorInterval(ctx context.Context, m *PushMirror) error
UpdatePushMirrorInterval updates the push-mirror
func UpdateRelease ¶
UpdateRelease updates all columns of a release
func UpdateReleaseNumCommits ¶
func UpdateReleasesMigrationsByType ¶
func UpdateReleasesMigrationsByType(ctx context.Context, gitServiceType structs.GitServiceType, originalAuthorID string, posterID int64) error
UpdateReleasesMigrationsByType updates all migrated repositories' releases from gitServiceType to replace originalAuthorID to posterID
func UpdateRepoArchiverStatus ¶
func UpdateRepoArchiverStatus(ctx context.Context, archiver *RepoArchiver) error
UpdateRepoArchiverStatus updates archiver's status
func UpdateRepoIssueNumbers ¶
UpdateRepoIssueNumbers updates one of a repositories amount of (open|closed) (issues|PRs) with the current count
func UpdateRepoLicenses ¶
func UpdateRepoLicenses(ctx context.Context, repo *Repository, commitID string, licenses []string) error
UpdateRepoLicenses updates the license statistics for repository
func UpdateRepoSize ¶
UpdateRepoSize updates the repository size, calculating it using getDirectorySize
func UpdateRepoUnit ¶
UpdateRepoUnit updates the provided repo unit
func UpdateRepoUnitPublicAccess ¶
func UpdateRepositoryColsNoAutoTime ¶
func UpdateRepositoryColsNoAutoTime(ctx context.Context, repo *Repository, colName string, moreColNames ...string) error
UpdateRepositoryColsNoAutoTime updates repository's columns, doesn't change timestamp field automatically
func UpdateRepositoryColsWithAutoTime ¶
func UpdateRepositoryColsWithAutoTime(ctx context.Context, repo *Repository, colName string, moreColNames ...string) error
UpdateRepositoryColsWithAutoTime updates repository's columns and the timestamp fields automatically
func UpdateRepositoryOwnerName ¶
UpdateRepositoryOwnerName updates the owner name of all repositories owned by the user
func UpdateRepositoryOwnerNames ¶
UpdateRepositoryOwnerNames updates repository owner_names (this should only be used when the ownerName has changed case)
func UpdateRepositoryUpdatedTime ¶
UpdateRepositoryUpdatedTime updates a repository's updated time
func UpdateUploadSession ¶
func UpdateUploadSession(ctx context.Context, session *UploadSession) error
UpdateUploadSession updates an upload session
func UpdateUploadSessionChunks ¶
func UpdateUploadSessionChunks(ctx context.Context, session *UploadSession) error
UpdateUploadSessionChunks updates the chunk counts for a session
func UploadSessionTempPath ¶
TempRelativePath returns the relative path for temporary chunk storage
func UserAccessRepoCond ¶
UserAccessRepoCond returns a condition for selecting all repositories a user has unit independent access to
func UserAssignedRepoCond ¶
UserAssignedRepoCond return user as assignee repositories list
func UserCollaborationRepoCond ¶
userCollaborationRepoCond returns a condition for selecting all repositories a user is collaborator in
func UserCreateIssueRepoCond ¶
UserCreateIssueRepoCond return user created issues repositories list
func UserMentionedRepoCond ¶
UserMentionedRepoCond return user metinoed repositories list
func UserOrgPublicUnitRepoCond ¶
UserOrgPublicUnitRepoCond returns the condition that one user could access all public repositories in the special organization
func UserOrgTeamRepoCond ¶
UserOrgTeamRepoCond selects repos that the given user has access to through team membership
func UserOrgUnitRepoCond ¶
UserOrgUnitRepoCond selects repos that the given user has access to through org and the special unit
func UserOwnedRepoCond ¶
UserOwnedRepoCond returns user ownered repositories
func ValidateTopic ¶
ValidateTopic checks a topic by length and match pattern rules
func VerifyPagesDomain ¶
VerifyPagesDomain marks a domain as verified
func WatchIfAuto ¶
WatchIfAuto subscribes to repo if AutoWatchOnChanges is set
func WatchRepo ¶
func WatchRepo(ctx context.Context, doer *user_model.User, repo *Repository, doWatch bool) error
WatchRepo watch or unwatch repository.
Types ¶
type AccessibleReposEnvironment ¶
type AccessibleReposEnvironment interface {
CountRepos(ctx context.Context) (int64, error)
RepoIDs(ctx context.Context) ([]int64, error)
MirrorRepos(ctx context.Context) (RepositoryList, error)
AddKeyword(keyword string)
SetSort(db.SearchOrderBy)
}
AccessibleReposEnvironment operations involving the repositories that are accessible to a particular user
func AccessibleReposEnv ¶
func AccessibleReposEnv(ctx context.Context, org *org_model.Organization, userID int64) (AccessibleReposEnvironment, error)
AccessibleReposEnv builds an AccessibleReposEnvironment for the repositories in `org` that are accessible to the specified user.
func AccessibleTeamReposEnv ¶
func AccessibleTeamReposEnv(org *org_model.Organization, team *org_model.Team) AccessibleReposEnvironment
AccessibleTeamReposEnv an AccessibleReposEnvironment for the repositories in `org` that are accessible to the specified team.
type ActionsConfig ¶
type ActionsConfig struct {
DisabledWorkflows []string
// CollaborativeOwnerIDs is a list of owner IDs used to share actions from private repos.
// Only workflows from the private repos whose owners are in CollaborativeOwnerIDs can access the current repo's actions.
CollaborativeOwnerIDs []int64
}
func (*ActionsConfig) AddCollaborativeOwner ¶
func (cfg *ActionsConfig) AddCollaborativeOwner(ownerID int64)
func (*ActionsConfig) DisableWorkflow ¶
func (cfg *ActionsConfig) DisableWorkflow(file string)
func (*ActionsConfig) EnableWorkflow ¶
func (cfg *ActionsConfig) EnableWorkflow(file string)
func (*ActionsConfig) FromDB ¶
func (cfg *ActionsConfig) FromDB(bs []byte) error
FromDB fills up a ActionsConfig from serialized format.
func (*ActionsConfig) IsCollaborativeOwner ¶
func (cfg *ActionsConfig) IsCollaborativeOwner(ownerID int64) bool
func (*ActionsConfig) IsWorkflowDisabled ¶
func (cfg *ActionsConfig) IsWorkflowDisabled(file string) bool
func (*ActionsConfig) RemoveCollaborativeOwner ¶
func (cfg *ActionsConfig) RemoveCollaborativeOwner(ownerID int64)
func (*ActionsConfig) ToDB ¶
func (cfg *ActionsConfig) ToDB() ([]byte, error)
ToDB exports a ActionsConfig to a serialized format.
func (*ActionsConfig) ToString ¶
func (cfg *ActionsConfig) ToString() string
type ArchiveType ¶
type ArchiveType int
ArchiveType archive types
const ( ArchiveUnknown ArchiveType = iota ArchiveZip // 1 ArchiveTarGz // 2 ArchiveBundle // 3 )
func SplitArchiveNameType ¶
func SplitArchiveNameType(s string) (string, ArchiveType)
func (ArchiveType) String ¶
func (a ArchiveType) String() string
String converts an ArchiveType to string: the extension of the archive file without prefix dot
type Attachment ¶
type Attachment struct {
ID int64 `xorm:"pk autoincr"`
UUID string `xorm:"uuid UNIQUE"`
RepoID int64 `xorm:"INDEX"` // this should not be zero
IssueID int64 `xorm:"INDEX"` // maybe zero when creating
ReleaseID int64 `xorm:"INDEX"` // maybe zero when creating
UploaderID int64 `xorm:"INDEX DEFAULT 0"` // Notice: will be zero before this column added
CommentID int64 `xorm:"INDEX"`
Name string
DownloadCount int64 `xorm:"DEFAULT 0"`
Size int64 `xorm:"DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
CustomDownloadURL string `xorm:"-"`
}
Attachment represent a attachment of issue/comment/release.
func GetAttachmentByID ¶
func GetAttachmentByID(ctx context.Context, id int64) (*Attachment, error)
GetAttachmentByID returns attachment by given id
func GetAttachmentByReleaseIDFileName ¶
func GetAttachmentByReleaseIDFileName(ctx context.Context, releaseID int64, fileName string) (*Attachment, error)
GetAttachmentByReleaseIDFileName returns attachment by given releaseId and fileName.
func GetAttachmentByUUID ¶
func GetAttachmentByUUID(ctx context.Context, uuid string) (*Attachment, error)
GetAttachmentByUUID returns attachment by given UUID.
func GetAttachmentsByCommentID ¶
func GetAttachmentsByCommentID(ctx context.Context, commentID int64) ([]*Attachment, error)
GetAttachmentsByCommentID returns all attachments if comment by given ID.
func GetAttachmentsByIssueID ¶
func GetAttachmentsByIssueID(ctx context.Context, issueID int64) ([]*Attachment, error)
GetAttachmentsByIssueID returns all attachments of an issue.
func GetAttachmentsByIssueIDImagesLatest ¶
func GetAttachmentsByIssueIDImagesLatest(ctx context.Context, issueID int64) ([]*Attachment, error)
GetAttachmentsByIssueIDImagesLatest returns the latest image attachments of an issue.
func GetAttachmentsByUUIDs ¶
func GetAttachmentsByUUIDs(ctx context.Context, uuids []string) ([]*Attachment, error)
GetAttachmentsByUUIDs returns attachment by given UUID list.
func (*Attachment) DownloadURL ¶
func (a *Attachment) DownloadURL() string
DownloadURL returns the download url of the attached file
func (*Attachment) IncreaseDownloadCount ¶
func (a *Attachment) IncreaseDownloadCount(ctx context.Context) error
IncreaseDownloadCount is update download count + 1
func (*Attachment) RelativePath ¶
func (a *Attachment) RelativePath() string
RelativePath returns the relative path of the attachment
type CloneLink ¶
CloneLink represents different types of clone URLs of repository.
type Collaboration ¶
type Collaboration struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
UserID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
Mode perm.AccessMode `xorm:"DEFAULT 2 NOT NULL"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}
Collaboration represent the relation between an individual and a repository.
type Collaborator ¶
type Collaborator struct {
*user_model.User
Collaboration *Collaboration
}
Collaborator represents a user with collaboration details.
func GetCollaborators ¶
func GetCollaborators(ctx context.Context, opts *FindCollaborationOptions) ([]*Collaborator, int64, error)
GetCollaborators returns the collaborators for a repository
type CountRepositoryOptions ¶
type ErrAttachmentNotExist ¶
ErrAttachmentNotExist represents a "AttachmentNotExist" kind of error.
func (ErrAttachmentNotExist) Error ¶
func (err ErrAttachmentNotExist) Error() string
func (ErrAttachmentNotExist) Unwrap ¶
func (err ErrAttachmentNotExist) Unwrap() error
type ErrNoPendingRepoTransfer ¶
type ErrNoPendingRepoTransfer struct {
RepoID int64
}
ErrNoPendingRepoTransfer is an error type for repositories without a pending transfer request
func (ErrNoPendingRepoTransfer) Error ¶
func (err ErrNoPendingRepoTransfer) Error() string
func (ErrNoPendingRepoTransfer) Unwrap ¶
func (err ErrNoPendingRepoTransfer) Unwrap() error
type ErrPagesConfigNotExist ¶
type ErrPagesConfigNotExist struct {
RepoID int64
}
ErrPagesConfigNotExist represents a "pages config not exist" error
func (ErrPagesConfigNotExist) Error ¶
func (err ErrPagesConfigNotExist) Error() string
type ErrPagesDomainAlreadyExist ¶
type ErrPagesDomainAlreadyExist struct {
Domain string
}
ErrPagesDomainAlreadyExist represents a "pages domain already exist" error
func (ErrPagesDomainAlreadyExist) Error ¶
func (err ErrPagesDomainAlreadyExist) Error() string
type ErrPagesDomainNotExist ¶
ErrPagesDomainNotExist represents a "pages domain not exist" error
func (ErrPagesDomainNotExist) Error ¶
func (err ErrPagesDomainNotExist) Error() string
type ErrReachLimitOfRepo ¶
type ErrReachLimitOfRepo struct {
Limit int
}
ErrReachLimitOfRepo represents a "ReachLimitOfRepo" kind of error.
func (ErrReachLimitOfRepo) Error ¶
func (err ErrReachLimitOfRepo) Error() string
func (ErrReachLimitOfRepo) Unwrap ¶
func (err ErrReachLimitOfRepo) Unwrap() error
type ErrRedirectNotExist ¶
ErrRedirectNotExist represents a "RedirectNotExist" kind of error.
func (ErrRedirectNotExist) Error ¶
func (err ErrRedirectNotExist) Error() string
func (ErrRedirectNotExist) Unwrap ¶
func (err ErrRedirectNotExist) Unwrap() error
type ErrReleaseAlreadyExist ¶
type ErrReleaseAlreadyExist struct {
TagName string
}
ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.
func (ErrReleaseAlreadyExist) Error ¶
func (err ErrReleaseAlreadyExist) Error() string
func (ErrReleaseAlreadyExist) Unwrap ¶
func (err ErrReleaseAlreadyExist) Unwrap() error
type ErrReleaseNotExist ¶
ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.
func (ErrReleaseNotExist) Error ¶
func (err ErrReleaseNotExist) Error() string
func (ErrReleaseNotExist) Unwrap ¶
func (err ErrReleaseNotExist) Unwrap() error
type ErrRepoAlreadyExist ¶
ErrRepoAlreadyExist represents a "RepoAlreadyExist" kind of error.
func (ErrRepoAlreadyExist) Error ¶
func (err ErrRepoAlreadyExist) Error() string
func (ErrRepoAlreadyExist) Unwrap ¶
func (err ErrRepoAlreadyExist) Unwrap() error
type ErrRepoFilesAlreadyExist ¶
ErrRepoFilesAlreadyExist represents a "RepoFilesAlreadyExist" kind of error.
func (ErrRepoFilesAlreadyExist) Error ¶
func (err ErrRepoFilesAlreadyExist) Error() string
func (ErrRepoFilesAlreadyExist) Unwrap ¶
func (err ErrRepoFilesAlreadyExist) Unwrap() error
type ErrRepoIsArchived ¶
type ErrRepoIsArchived struct {
Repo *Repository
}
func (ErrRepoIsArchived) Error ¶
func (err ErrRepoIsArchived) Error() string
type ErrRepoNotExist ¶
ErrRepoNotExist represents a "RepoNotExist" kind of error.
func (ErrRepoNotExist) Error ¶
func (err ErrRepoNotExist) Error() string
func (ErrRepoNotExist) Unwrap ¶
func (err ErrRepoNotExist) Unwrap() error
Unwrap unwraps this error as a ErrNotExist error
type ErrRepoTransferInProgress ¶
ErrRepoTransferInProgress represents the state of a repository that has an ongoing transfer
func (ErrRepoTransferInProgress) Error ¶
func (err ErrRepoTransferInProgress) Error() string
func (ErrRepoTransferInProgress) Unwrap ¶
func (err ErrRepoTransferInProgress) Unwrap() error
type ErrTopicNotExist ¶
type ErrTopicNotExist struct {
Name string
}
ErrTopicNotExist represents an error that a topic is not exist
func (ErrTopicNotExist) Error ¶
func (err ErrTopicNotExist) Error() string
Error implements error interface
func (ErrTopicNotExist) Unwrap ¶
func (err ErrTopicNotExist) Unwrap() error
type ErrUnitTypeNotExist ¶
ErrUnitTypeNotExist represents a "UnitTypeNotExist" kind of error.
func (ErrUnitTypeNotExist) Error ¶
func (err ErrUnitTypeNotExist) Error() string
func (ErrUnitTypeNotExist) Unwrap ¶
func (err ErrUnitTypeNotExist) Unwrap() error
type ErrUploadNotExist ¶
ErrUploadNotExist represents a "UploadNotExist" kind of error.
func (ErrUploadNotExist) Error ¶
func (err ErrUploadNotExist) Error() string
func (ErrUploadNotExist) Unwrap ¶
func (err ErrUploadNotExist) Unwrap() error
type ErrUploadSessionExpired ¶
type ErrUploadSessionExpired struct {
UUID string
}
ErrUploadSessionExpired represents an expired session error
func (ErrUploadSessionExpired) Error ¶
func (err ErrUploadSessionExpired) Error() string
type ErrUploadSessionNotExist ¶
ErrUploadSessionNotExist represents a "UploadSessionNotExist" kind of error.
func (ErrUploadSessionNotExist) Error ¶
func (err ErrUploadSessionNotExist) Error() string
func (ErrUploadSessionNotExist) Unwrap ¶
func (err ErrUploadSessionNotExist) Unwrap() error
type ErrUserDoesNotHaveAccessToRepo ¶
ErrUserDoesNotHaveAccessToRepo represents an error where the user doesn't has access to a given repo.
func (ErrUserDoesNotHaveAccessToRepo) Error ¶
func (err ErrUserDoesNotHaveAccessToRepo) Error() string
func (ErrUserDoesNotHaveAccessToRepo) Unwrap ¶
func (err ErrUserDoesNotHaveAccessToRepo) Unwrap() error
type ErrUserOwnRepos ¶
type ErrUserOwnRepos struct {
UID int64
}
ErrUserOwnRepos represents a "UserOwnRepos" kind of error.
func (ErrUserOwnRepos) Error ¶
func (err ErrUserOwnRepos) Error() string
type ErrWikiAlreadyExist ¶
type ErrWikiAlreadyExist struct {
Title string
}
ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.
func (ErrWikiAlreadyExist) Error ¶
func (err ErrWikiAlreadyExist) Error() string
func (ErrWikiAlreadyExist) Unwrap ¶
func (err ErrWikiAlreadyExist) Unwrap() error
type ErrWikiInvalidFileName ¶
type ErrWikiInvalidFileName struct {
FileName string
}
ErrWikiInvalidFileName represents an invalid wiki file name.
func (ErrWikiInvalidFileName) Error ¶
func (err ErrWikiInvalidFileName) Error() string
func (ErrWikiInvalidFileName) Unwrap ¶
func (err ErrWikiInvalidFileName) Unwrap() error
type ErrWikiReservedName ¶
type ErrWikiReservedName struct {
Title string
}
ErrWikiReservedName represents a reserved name error.
func (ErrWikiReservedName) Error ¶
func (err ErrWikiReservedName) Error() string
func (ErrWikiReservedName) Unwrap ¶
func (err ErrWikiReservedName) Unwrap() error
type ExternalTrackerConfig ¶
type ExternalTrackerConfig struct {
ExternalTrackerURL string
ExternalTrackerFormat string
ExternalTrackerStyle string
ExternalTrackerRegexpPattern string
}
ExternalTrackerConfig describes external tracker config
func (*ExternalTrackerConfig) FromDB ¶
func (cfg *ExternalTrackerConfig) FromDB(bs []byte) error
FromDB fills up a ExternalTrackerConfig from serialized format.
func (*ExternalTrackerConfig) ToDB ¶
func (cfg *ExternalTrackerConfig) ToDB() ([]byte, error)
ToDB exports a ExternalTrackerConfig to a serialized format.
type ExternalWikiConfig ¶
type ExternalWikiConfig struct {
ExternalWikiURL string
}
ExternalWikiConfig describes external wiki config
func (*ExternalWikiConfig) FromDB ¶
func (cfg *ExternalWikiConfig) FromDB(bs []byte) error
FromDB fills up a ExternalWikiConfig from serialized format.
func (*ExternalWikiConfig) ToDB ¶
func (cfg *ExternalWikiConfig) ToDB() ([]byte, error)
ToDB exports a ExternalWikiConfig to a serialized format.
type FindCollaborationOptions ¶
type FindCollaborationOptions struct {
db.ListOptions
RepoID int64
RepoOwnerID int64
CollaboratorID int64
}
func (*FindCollaborationOptions) ToConds ¶
func (opts *FindCollaborationOptions) ToConds() builder.Cond
func (*FindCollaborationOptions) ToJoins ¶
func (opts *FindCollaborationOptions) ToJoins() []db.JoinFunc
type FindReleasesOptions ¶
type FindReleasesOptions struct {
db.ListOptions
RepoID int64
IncludeDrafts bool
IncludeTags bool
IncludeArchived bool
IsPreRelease optional.Option[bool]
IsDraft optional.Option[bool]
IsArchived optional.Option[bool]
TagNames []string
HasSha1 optional.Option[bool] // useful to find draft releases which are created with existing tags
NamePattern optional.Option[string]
}
FindReleasesOptions describes the conditions to Find releases
func (FindReleasesOptions) ToConds ¶
func (opts FindReleasesOptions) ToConds() builder.Cond
func (FindReleasesOptions) ToOrders ¶
func (opts FindReleasesOptions) ToOrders() string
type FindRepoArchiversOption ¶
type FindRepoArchiversOption struct {
db.ListOptions
OlderThan time.Duration
}
FindRepoArchiversOption represents an archiver options
func (FindRepoArchiversOption) ToConds ¶
func (opts FindRepoArchiversOption) ToConds() builder.Cond
func (FindRepoArchiversOption) ToOrders ¶
func (opts FindRepoArchiversOption) ToOrders() string
type FindTopicOptions ¶
type FindTopicOptions struct {
db.ListOptions
RepoID int64
Keyword string
}
FindTopicOptions represents the options when fdin topics
func (*FindTopicOptions) ToConds ¶
func (opts *FindTopicOptions) ToConds() builder.Cond
func (*FindTopicOptions) ToJoins ¶
func (opts *FindTopicOptions) ToJoins() []db.JoinFunc
func (*FindTopicOptions) ToOrders ¶
func (opts *FindTopicOptions) ToOrders() string
type IssuesConfig ¶
type IssuesConfig struct {
EnableTimetracker bool
AllowOnlyContributorsToTrackTime bool
EnableDependencies bool
}
IssuesConfig describes issues config
func (*IssuesConfig) FromDB ¶
func (cfg *IssuesConfig) FromDB(bs []byte) error
FromDB fills up a IssuesConfig from serialized format.
func (*IssuesConfig) ToDB ¶
func (cfg *IssuesConfig) ToDB() ([]byte, error)
ToDB exports a IssuesConfig to a serialized format.
type LanguageStat ¶
type LanguageStat struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"`
CommitID string
IsPrimary bool
Language string `xorm:"VARCHAR(50) UNIQUE(s) INDEX NOT NULL"`
Percentage float32 `xorm:"-"`
Size int64 `xorm:"NOT NULL DEFAULT 0"`
Color string `xorm:"-"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX CREATED"`
}
LanguageStat describes language statistics of a repository
type LanguageStatList ¶
type LanguageStatList []*LanguageStat
LanguageStatList defines a list of language statistics
func GetLanguageStats ¶
func GetLanguageStats(ctx context.Context, repo *Repository) (LanguageStatList, error)
GetLanguageStats returns the language statistics for a repository
func GetTopLanguageStats ¶
func GetTopLanguageStats(ctx context.Context, repo *Repository, limit int) (LanguageStatList, error)
GetTopLanguageStats returns the top language statistics for a repository
func (LanguageStatList) LoadAttributes ¶
func (stats LanguageStatList) LoadAttributes()
LoadAttributes loads attributes
type MergeStyle ¶
type MergeStyle string
MergeStyle represents the approach to merge commits into base branch.
const ( // MergeStyleMerge create merge commit MergeStyleMerge MergeStyle = "merge" // MergeStyleRebase rebase before merging, and fast-forward MergeStyleRebase MergeStyle = "rebase" // MergeStyleRebaseMerge rebase before merging with merge commit (--no-ff) MergeStyleRebaseMerge MergeStyle = "rebase-merge" // MergeStyleSquash squash commits into single commit before merging MergeStyleSquash MergeStyle = "squash" // MergeStyleFastForwardOnly fast-forward merge if possible, otherwise fail MergeStyleFastForwardOnly MergeStyle = "fast-forward-only" // MergeStyleManuallyMerged pr has been merged manually, just mark it as merged directly MergeStyleManuallyMerged MergeStyle = "manually-merged" // MergeStyleRebaseUpdate not a merge style, used to update pull head by rebase MergeStyleRebaseUpdate MergeStyle = "rebase-update-only" )
type Mirror ¶
type Mirror struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
Repo *Repository `xorm:"-"`
Interval time.Duration
EnablePrune bool `xorm:"NOT NULL DEFAULT true"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX"`
NextUpdateUnix timeutil.TimeStamp `xorm:"INDEX"`
LFS bool `xorm:"lfs_enabled NOT NULL DEFAULT false"`
LFSEndpoint string `xorm:"lfs_endpoint TEXT"`
RemoteAddress string `xorm:"VARCHAR(2048)"`
}
Mirror represents mirror information of a repository.
func GetMirrorByRepoID ¶
GetMirrorByRepoID returns mirror information of a repository.
func (*Mirror) BeforeInsert ¶
func (m *Mirror) BeforeInsert()
BeforeInsert will be invoked by XORM before inserting a record
func (*Mirror) GetRemoteName ¶
GetRemoteName returns the name of the remote.
func (*Mirror) GetRepository ¶
func (m *Mirror) GetRepository(ctx context.Context) *Repository
GetRepository returns the repository.
type PagesConfig ¶
type PagesConfig struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"UNIQUE NOT NULL"`
Enabled bool `xorm:"DEFAULT false"`
Template PagesTemplate `xorm:"VARCHAR(32) DEFAULT 'simple'"`
ConfigJSON string `xorm:"TEXT"` // Cached parsed config from landing.yaml
ConfigHash string `xorm:"VARCHAR(64)"` // Hash for invalidation
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
Repo *Repository `xorm:"-"`
}
PagesConfig represents the cached configuration for a repository's landing page
func GetPagesConfig ¶
func GetPagesConfig(ctx context.Context, repoID int64) (*PagesConfig, error)
GetPagesConfig returns the pages config for a repository with proper error handling
func GetPagesConfigByRepoID ¶
func GetPagesConfigByRepoID(ctx context.Context, repoID int64) (*PagesConfig, error)
GetPagesConfigByRepoID returns the pages config for a repository
func (*PagesConfig) TableName ¶
func (c *PagesConfig) TableName() string
TableName returns the table name for PagesConfig
type PagesDomain ¶
type PagesDomain struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
Domain string `xorm:"UNIQUE NOT NULL"`
Verified bool `xorm:"DEFAULT false"`
VerificationToken string `xorm:"VARCHAR(64)"`
SSLStatus SSLStatus `xorm:"VARCHAR(32) DEFAULT 'pending'"`
SSLCertExpiry timeutil.TimeStamp `xorm:"DEFAULT 0"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
VerifiedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"`
Repo *Repository `xorm:"-"`
}
PagesDomain represents a custom domain mapping for Gitea Pages
func GetPagesDomainByDomain ¶
func GetPagesDomainByDomain(ctx context.Context, domainName string) (*PagesDomain, error)
GetPagesDomainByDomain returns a pages domain by domain name
func GetPagesDomainByID ¶
func GetPagesDomainByID(ctx context.Context, id int64) (*PagesDomain, error)
GetPagesDomainByID returns a pages domain by ID
func GetPagesDomains ¶
func GetPagesDomains(ctx context.Context, repoID int64) ([]*PagesDomain, error)
GetPagesDomains returns all custom domains for a repository
func GetPagesDomainsByRepoID ¶
func GetPagesDomainsByRepoID(ctx context.Context, repoID int64) ([]*PagesDomain, error)
GetPagesDomainsByRepoID returns all custom domains for a repository
func (*PagesDomain) TableName ¶
func (d *PagesDomain) TableName() string
TableName returns the table name for PagesDomain
type PagesTemplate ¶
type PagesTemplate string
PagesTemplate represents the type of landing page template
const ( PagesTemplateSimple PagesTemplate = "simple" PagesTemplateDocumentation PagesTemplate = "documentation" PagesTemplateProduct PagesTemplate = "product" PagesTemplatePortfolio PagesTemplate = "portfolio" )
type PendingRepositoryTransferOptions ¶
func (*PendingRepositoryTransferOptions) ToConds ¶
func (opts *PendingRepositoryTransferOptions) ToConds() builder.Cond
type ProjectsConfig ¶
type ProjectsConfig struct {
ProjectsMode ProjectsMode
}
ProjectsConfig describes projects config
func (*ProjectsConfig) FromDB ¶
func (cfg *ProjectsConfig) FromDB(bs []byte) error
FromDB fills up a ProjectsConfig from serialized format.
func (*ProjectsConfig) GetProjectsMode ¶
func (cfg *ProjectsConfig) GetProjectsMode() ProjectsMode
func (*ProjectsConfig) IsProjectsAllowed ¶
func (cfg *ProjectsConfig) IsProjectsAllowed(m ProjectsMode) bool
func (*ProjectsConfig) ToDB ¶
func (cfg *ProjectsConfig) ToDB() ([]byte, error)
ToDB exports a ProjectsConfig to a serialized format.
type ProjectsMode ¶
type ProjectsMode string
ProjectsMode represents the projects enabled for a repository
const ( // ProjectsModeRepo allows only repo-level projects ProjectsModeRepo ProjectsMode = "repo" // ProjectsModeOwner allows only owner-level projects ProjectsModeOwner ProjectsMode = "owner" // ProjectsModeAll allows both kinds of projects ProjectsModeAll ProjectsMode = "all" // ProjectsModeNone doesn't allow projects ProjectsModeNone ProjectsMode = "none" )
type PullRequestsConfig ¶
type PullRequestsConfig struct {
IgnoreWhitespaceConflicts bool
AllowMerge bool
AllowRebase bool
AllowRebaseMerge bool
AllowSquash bool
AllowFastForwardOnly bool
AllowManualMerge bool
AutodetectManualMerge bool
AllowRebaseUpdate bool
DefaultDeleteBranchAfterMerge bool
DefaultMergeStyle MergeStyle
DefaultAllowMaintainerEdit bool
}
PullRequestsConfig describes pull requests config
func (*PullRequestsConfig) FromDB ¶
func (cfg *PullRequestsConfig) FromDB(bs []byte) error
FromDB fills up a PullRequestsConfig from serialized format.
func (*PullRequestsConfig) GetDefaultMergeStyle ¶
func (cfg *PullRequestsConfig) GetDefaultMergeStyle() MergeStyle
GetDefaultMergeStyle returns the default merge style for this pull request
func (*PullRequestsConfig) IsMergeStyleAllowed ¶
func (cfg *PullRequestsConfig) IsMergeStyleAllowed(mergeStyle MergeStyle) bool
IsMergeStyleAllowed returns if merge style is allowed
func (*PullRequestsConfig) ToDB ¶
func (cfg *PullRequestsConfig) ToDB() ([]byte, error)
ToDB exports a PullRequestsConfig to a serialized format.
type PushMirror ¶
type PushMirror struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX"`
Repo *Repository `xorm:"-"`
RemoteName string
RemoteAddress string `xorm:"VARCHAR(2048)"`
SyncOnCommit bool `xorm:"NOT NULL DEFAULT true"`
Interval time.Duration
CreatedUnix timeutil.TimeStamp `xorm:"created"`
LastUpdateUnix timeutil.TimeStamp `xorm:"INDEX last_update"`
LastError string `xorm:"text"`
}
PushMirror represents mirror information of a repository.
func GetPushMirrorByIDAndRepoID ¶
func GetPushMirrorsByRepoID ¶
func GetPushMirrorsByRepoID(ctx context.Context, repoID int64, listOptions db.ListOptions) ([]*PushMirror, int64, error)
GetPushMirrorsByRepoID returns push-mirror information of a repository.
func GetPushMirrorsSyncedOnCommit ¶
func GetPushMirrorsSyncedOnCommit(ctx context.Context, repoID int64) ([]*PushMirror, error)
GetPushMirrorsSyncedOnCommit returns push-mirrors for this repo that should be updated by new commits
func (*PushMirror) GetRemoteName ¶
func (m *PushMirror) GetRemoteName() string
GetRemoteName returns the name of the remote.
func (*PushMirror) GetRepository ¶
func (m *PushMirror) GetRepository(ctx context.Context) *Repository
GetRepository returns the path of the repository.
type PushMirrorOptions ¶
type PushMirrorOptions struct {
db.ListOptions
ID int64
RepoID int64
RemoteName string
}
func (PushMirrorOptions) ToConds ¶
func (opts PushMirrorOptions) ToConds() builder.Cond
type Redirect ¶
type Redirect struct {
ID int64 `xorm:"pk autoincr"`
OwnerID int64 `xorm:"UNIQUE(s)"`
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
RedirectRepoID int64 // repoID to redirect to
}
Redirect represents that a repo name should be redirected to another
type Release ¶
type Release struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX UNIQUE(n)"`
Repo *Repository `xorm:"-"`
PublisherID int64 `xorm:"INDEX"`
Publisher *user_model.User `xorm:"-"`
TagName string `xorm:"INDEX UNIQUE(n)"`
OriginalAuthor string
OriginalAuthorID int64 `xorm:"index"`
LowerTagName string
Target string
TargetBehind string `xorm:"-"` // to handle non-existing or empty target
Title string
Sha1 string `xorm:"INDEX VARCHAR(64)"`
NumCommits int64
NumCommitsBehind int64 `xorm:"-"`
Note string `xorm:"TEXT"`
RenderedNote template.HTML `xorm:"-"`
IsDraft bool `xorm:"NOT NULL DEFAULT false"`
IsPrerelease bool `xorm:"NOT NULL DEFAULT false"`
IsTag bool `xorm:"NOT NULL DEFAULT false"` // will be true only if the record is a tag and has no related releases
IsArchived bool `xorm:"NOT NULL DEFAULT false"`
ArchivedUnix timeutil.TimeStamp `xorm:"INDEX"`
Attachments []*Attachment `xorm:"-"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX"`
}
Release represents a release of repository.
func GetLatestReleaseByRepoID ¶
GetLatestReleaseByRepoID returns the latest release for a repository
func GetRelease ¶
GetRelease returns release by given ID.
func GetReleaseByID ¶
GetReleaseByID returns release with given ID.
func GetReleaseForRepoByID ¶
GetReleaseForRepoByID returns release with given ID.
func (*Release) APIURL ¶
APIURL the api url for a release. release must have attributes loaded
func (*Release) APIUploadURL ¶
APIUploadURL the api url to upload assets to a release. release must have attributes loaded
func (*Release) GetExternalID ¶
ExternalID ExternalUserRemappable interface
func (*Release) GetExternalName ¶
ExternalName ExternalUserRemappable interface
func (*Release) GetUserID ¶
UserID ExternalUserRemappable interface
func (*Release) HTMLURL ¶
HTMLURL the url for a release on the web UI. release must have attributes loaded
func (*Release) Link ¶
Link the relative url for a release on the web UI. release must have attributes loaded
func (*Release) LoadAttributes ¶
LoadAttributes load repo and publisher attributes for a release
func (*Release) RemapExternalUser ¶
RemapExternalUser ExternalUserRemappable interface
func (*Release) TarURL ¶
TarURL the tar.gz url for a release. release must have attributes loaded
type RepoArchiver ¶
type RepoArchiver struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"index unique(s)"`
Type ArchiveType `xorm:"unique(s)"`
Status ArchiverStatus
CommitID string `xorm:"VARCHAR(64) unique(s)"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL created"`
}
RepoArchiver represents all archivers
func GetRepoArchiver ¶
func GetRepoArchiver(ctx context.Context, repoID int64, tp ArchiveType, commitID string) (*RepoArchiver, error)
GetRepoArchiver get an archiver
func (*RepoArchiver) RelativePath ¶
func (archiver *RepoArchiver) RelativePath() string
RelativePath returns the archive path relative to the archive storage root.
type RepoIndexerStatus ¶
type RepoIndexerStatus struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX(s)"`
CommitSha string `xorm:"VARCHAR(64)"`
IndexerType RepoIndexerType `xorm:"INDEX(s) NOT NULL DEFAULT 0"`
}
RepoIndexerStatus status of a repo's entry in the repo indexer For now, implicitly refers to default branch
func GetIndexerStatus ¶
func GetIndexerStatus(ctx context.Context, repo *Repository, indexerType RepoIndexerType) (*RepoIndexerStatus, error)
GetIndexerStatus loads repo codes indxer status
type RepoIndexerType ¶
type RepoIndexerType int //revive:disable-line:exported
RepoIndexerType specifies the repository indexer type
const ( // RepoIndexerTypeCode code indexer RepoIndexerTypeCode RepoIndexerType = iota // 0 // RepoIndexerTypeStats repository stats indexer RepoIndexerTypeStats // 1 )
type RepoLicense ¶
type RepoLicenseList ¶
type RepoLicenseList []*RepoLicense //revive:disable-line:exported
RepoLicenseList defines a list of repo licenses
func GetRepoLicenses ¶
func GetRepoLicenses(ctx context.Context, repo *Repository) (RepoLicenseList, error)
GetRepoLicenses returns the license statistics for a repository
func (RepoLicenseList) StringList ¶
func (rll RepoLicenseList) StringList() []string
type RepoTopic ¶
RepoTopic represents associated repositories and topics
type RepoTransfer ¶
type RepoTransfer struct {
ID int64 `xorm:"pk autoincr"`
DoerID int64
Doer *user_model.User `xorm:"-"`
RecipientID int64
Recipient *user_model.User `xorm:"-"`
RepoID int64
Repo *Repository `xorm:"-"`
TeamIDs []int64
Teams []*organization.Team `xorm:"-"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL updated"`
}
RepoTransfer is used to manage repository transfers
func GetPendingRepositoryTransfer ¶
func GetPendingRepositoryTransfer(ctx context.Context, repo *Repository) (*RepoTransfer, error)
GetPendingRepositoryTransfer fetches the most recent and ongoing transfer process for the repository
func GetPendingRepositoryTransfers ¶
func GetPendingRepositoryTransfers(ctx context.Context, opts *PendingRepositoryTransferOptions) ([]*RepoTransfer, error)
func (*RepoTransfer) CanUserAcceptOrRejectTransfer ¶
func (r *RepoTransfer) CanUserAcceptOrRejectTransfer(ctx context.Context, u *user_model.User) bool
CanUserAcceptOrRejectTransfer checks if the user has the rights to accept/decline a repo transfer. For user, it checks if it's himself For organizations, it checks if the user is able to create repos
func (*RepoTransfer) LoadAttributes ¶
func (r *RepoTransfer) LoadAttributes(ctx context.Context) error
LoadAttributes fetches the transfer recipient from the database
func (*RepoTransfer) LoadRecipient ¶
func (r *RepoTransfer) LoadRecipient(ctx context.Context) error
func (*RepoTransfer) LoadRepo ¶
func (r *RepoTransfer) LoadRepo(ctx context.Context) error
type RepoUnit ¶
type RepoUnit struct {
ID int64
RepoID int64 `xorm:"INDEX(s)"`
Type unit.Type `xorm:"INDEX(s)"`
Config convert.Conversion `xorm:"TEXT"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX CREATED"`
AnonymousAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"`
EveryoneAccessMode perm.AccessMode `xorm:"NOT NULL DEFAULT 0"`
}
RepoUnit describes all units of a repository
func (*RepoUnit) ActionsConfig ¶
func (r *RepoUnit) ActionsConfig() *ActionsConfig
ActionsConfig returns config for unit.ActionsConfig
func (*RepoUnit) BeforeSet ¶
BeforeSet is invoked from XORM before setting the value of a field of this object.
func (*RepoUnit) CodeConfig ¶
func (r *RepoUnit) CodeConfig() *UnitConfig
CodeConfig returns config for unit.TypeCode
func (*RepoUnit) ExternalTrackerConfig ¶
func (r *RepoUnit) ExternalTrackerConfig() *ExternalTrackerConfig
ExternalTrackerConfig returns config for unit.TypeExternalTracker
func (*RepoUnit) ExternalWikiConfig ¶
func (r *RepoUnit) ExternalWikiConfig() *ExternalWikiConfig
ExternalWikiConfig returns config for unit.TypeExternalWiki
func (*RepoUnit) IssuesConfig ¶
func (r *RepoUnit) IssuesConfig() *IssuesConfig
IssuesConfig returns config for unit.TypeIssues
func (*RepoUnit) ProjectsConfig ¶
func (r *RepoUnit) ProjectsConfig() *ProjectsConfig
ProjectsConfig returns config for unit.ProjectsConfig
func (*RepoUnit) PullRequestsConfig ¶
func (r *RepoUnit) PullRequestsConfig() *PullRequestsConfig
PullRequestsConfig returns config for unit.TypePullRequests
func (*RepoUnit) ReleasesConfig ¶
func (r *RepoUnit) ReleasesConfig() *UnitConfig
ReleasesConfig returns config for unit.TypeReleases
type Repository ¶
type Repository struct {
ID int64 `xorm:"pk autoincr"`
OwnerID int64 `xorm:"UNIQUE(s) index"`
OwnerName string
Owner *user_model.User `xorm:"-"`
LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"`
Name string `xorm:"INDEX NOT NULL"`
Description string `xorm:"TEXT"`
DisplayTitle string `xorm:"VARCHAR(255)"`
GroupHeader string `xorm:"VARCHAR(255)"`
LicenseType string `xorm:"VARCHAR(50)"`
Website string `xorm:"VARCHAR(2048)"`
OriginalServiceType api.GitServiceType `xorm:"index"`
OriginalURL string `xorm:"VARCHAR(2048)"`
DefaultBranch string
DefaultWikiBranch string
NumWatches int
NumStars int
NumForks int
NumIssues int
NumClosedIssues int
NumOpenIssues int `xorm:"-"`
NumPulls int
NumClosedPulls int
NumOpenPulls int `xorm:"-"`
NumMilestones int `xorm:"NOT NULL DEFAULT 0"`
NumClosedMilestones int `xorm:"NOT NULL DEFAULT 0"`
NumOpenMilestones int `xorm:"-"`
NumProjects int `xorm:"NOT NULL DEFAULT 0"`
NumClosedProjects int `xorm:"NOT NULL DEFAULT 0"`
NumOpenProjects int `xorm:"-"`
NumActionRuns int `xorm:"NOT NULL DEFAULT 0"`
NumClosedActionRuns int `xorm:"NOT NULL DEFAULT 0"`
NumOpenActionRuns int `xorm:"-"`
IsPrivate bool `xorm:"INDEX"`
IsEmpty bool `xorm:"INDEX"`
IsArchived bool `xorm:"INDEX"`
IsMirror bool `xorm:"INDEX"`
Status RepositoryStatus `xorm:"NOT NULL DEFAULT 0"`
Units []*RepoUnit `xorm:"-"`
PrimaryLanguage *LanguageStat `xorm:"-"`
IsFork bool `xorm:"INDEX NOT NULL DEFAULT false"`
ForkID int64 `xorm:"INDEX"`
BaseRepo *Repository `xorm:"-"`
IsTemplate bool `xorm:"INDEX NOT NULL DEFAULT false"`
TemplateID int64 `xorm:"INDEX"`
Size int64 `xorm:"NOT NULL DEFAULT 0"`
GitSize int64 `xorm:"NOT NULL DEFAULT 0"`
LFSSize int64 `xorm:"NOT NULL DEFAULT 0"`
CodeIndexerStatus *RepoIndexerStatus `xorm:"-"`
StatsIndexerStatus *RepoIndexerStatus `xorm:"-"`
IsFsckEnabled bool `xorm:"NOT NULL DEFAULT true"`
CloseIssuesViaCommitInAnyBranch bool `xorm:"NOT NULL DEFAULT false"`
Topics []string `xorm:"TEXT JSON"`
ObjectFormatName string `xorm:"VARCHAR(6) NOT NULL DEFAULT 'sha1'"`
TrustModel TrustModelType
// Avatar: ID(10-20)-md5(32) - must fit into 64 symbols
Avatar string `xorm:"VARCHAR(64)"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
ArchivedUnix timeutil.TimeStamp `xorm:"DEFAULT 0"`
// contains filtered or unexported fields
}
Repository represents a git repository.
func FindUserOrgForks ¶
func FindUserOrgForks(ctx context.Context, repoID, userID int64) ([]*Repository, error)
FindUserOrgForks returns the forked repositories for one user from a repository
func GetForkedRepo ¶
func GetForkedRepo(ctx context.Context, ownerID, repoID int64) *Repository
GetForkedRepo checks if given user has already forked a repository with given ID.
func GetForksByUserAndOrgs ¶
func GetForksByUserAndOrgs(ctx context.Context, user *user_model.User, repo *Repository) ([]*Repository, error)
GetForksByUserAndOrgs return forked repos of the user and owned orgs
func GetRepositoriesByForkID ¶
func GetRepositoriesByForkID(ctx context.Context, forkID int64) ([]*Repository, error)
GetRepositoriesByForkID returns all repositories with given fork ID.
func GetRepositoryByID ¶
func GetRepositoryByID(ctx context.Context, id int64) (*Repository, error)
GetRepositoryByID returns the repository by given id if exists.
func GetRepositoryByName ¶
GetRepositoryByName returns the repository by given name under user if exists.
func GetRepositoryByOwnerAndName ¶
func GetRepositoryByOwnerAndName(ctx context.Context, ownerName, repoName string) (*Repository, error)
GetRepositoryByOwnerAndName returns the repository by given owner name and repo name
func GetRepositoryByURL ¶
func GetRepositoryByURL(ctx context.Context, repoURL string) (*Repository, error)
GetRepositoryByURL returns the repository by given url
func GetRepositoryByURLRelax ¶
func GetRepositoryByURLRelax(ctx context.Context, repoURL string) (*Repository, error)
GetRepositoryByURLRelax also accepts an SSH clone URL without user part
func GetStarredRepos ¶
func GetStarredRepos(ctx context.Context, opts *StarredReposOptions) ([]*Repository, error)
GetStarredRepos returns the repos starred by a particular user
func GetTemplateRepo ¶
func GetTemplateRepo(ctx context.Context, repo *Repository) (*Repository, error)
GetTemplateRepo populates repo.TemplateRepo for a generated repository and returns an error on failure (NOTE: no error is returned for non-generated repositories, and TemplateRepo will be left untouched)
func GetUserFork ¶
func GetUserFork(ctx context.Context, repoID, userID int64) (*Repository, error)
GetUserFork return user forked repository from this repository, if not forked return nil
func GetWatchedRepos ¶
func GetWatchedRepos(ctx context.Context, opts *WatchedReposOptions) ([]*Repository, int64, error)
GetWatchedRepos returns the repos watched by a particular user
func ValuesRepository ¶
func ValuesRepository(m map[int64]*Repository) []*Repository
ValuesRepository converts a repository map to a list FIXME: Remove in favor of maps.values when MIN_GO_VERSION >= 1.18
func (*Repository) APIURL ¶
func (repo *Repository) APIURL() string
APIURL returns the repository API URL
func (*Repository) AfterLoad ¶
func (repo *Repository) AfterLoad()
AfterLoad is invoked from XORM after setting the values of all fields of this object.
func (*Repository) AllowOnlyContributorsToTrackTime ¶
func (repo *Repository) AllowOnlyContributorsToTrackTime(ctx context.Context) bool
AllowOnlyContributorsToTrackTime returns value of IssuesConfig or the default value
func (*Repository) AllowsPulls ¶
func (repo *Repository) AllowsPulls(ctx context.Context) bool
AllowsPulls returns true if repository meets the requirements of accepting pulls and has them enabled.
func (*Repository) AvatarLink ¶
func (repo *Repository) AvatarLink(ctx context.Context) string
AvatarLink returns the full avatar url with http host or the empty string if the repo doesn't have an avatar.
TODO: refactor it to a relative URL, but it is still used in API response at the moment
func (*Repository) CanContentChange ¶
func (repo *Repository) CanContentChange() bool
func (*Repository) CanCreateBranch ¶
func (repo *Repository) CanCreateBranch() bool
CanCreateBranch returns true if repository meets the requirements for creating new branches.
func (*Repository) CanEnableEditor ¶
func (repo *Repository) CanEnableEditor() bool
CanEnableEditor returns true if repository meets the requirements of web editor. FIXME: most CanEnableEditor calls should be replaced with CanContentChange And all other like CanCreateBranch / CanEnablePulls should also be updated
func (*Repository) CanEnablePulls ¶
func (repo *Repository) CanEnablePulls() bool
CanEnablePulls returns true if repository meets the requirements of accepting pulls.
func (*Repository) CanEnableTimetracker ¶
func (repo *Repository) CanEnableTimetracker() bool
CanEnableTimetracker returns true when the server admin enabled time tracking This overrules IsTimetrackerEnabled
func (*Repository) CloneLink ¶
func (repo *Repository) CloneLink(ctx context.Context, doer *user_model.User) (cl *CloneLink)
CloneLink returns clone URLs of repository.
func (*Repository) CloneLinkGeneral ¶
func (repo *Repository) CloneLinkGeneral(ctx context.Context) (cl *CloneLink)
func (*Repository) CommitLink ¶
func (repo *Repository) CommitLink(commitID string) (result string)
CommitLink make link to by commit full ID note: won't check whether it's an right id
func (*Repository) ComposeBranchCompareURL ¶
func (repo *Repository) ComposeBranchCompareURL(baseRepo *Repository, branchName string) string
func (*Repository) ComposeCommentMetas ¶
func (repo *Repository) ComposeCommentMetas(ctx context.Context) map[string]string
ComposeCommentMetas composes a map of metas for properly rendering comments or comment-like contents (commit message)
func (*Repository) ComposeCompareURL ¶
func (repo *Repository) ComposeCompareURL(oldCommitID, newCommitID string) string
ComposeCompareURL returns the repository comparison URL
func (*Repository) ComposeRepoFileMetas ¶
func (repo *Repository) ComposeRepoFileMetas(ctx context.Context) map[string]string
ComposeRepoFileMetas composes a map of metas for properly rendering documents (repo files)
func (*Repository) ComposeWikiMetas ¶
func (repo *Repository) ComposeWikiMetas(ctx context.Context) map[string]string
ComposeWikiMetas composes a map of metas for properly rendering wikis
func (*Repository) CustomAvatarRelativePath ¶
func (repo *Repository) CustomAvatarRelativePath() string
CustomAvatarRelativePath returns repository custom avatar file path.
func (*Repository) DescriptionHTML ¶
func (repo *Repository) DescriptionHTML(ctx context.Context) template.HTML
DescriptionHTML does special handles to description and return HTML string.
func (*Repository) FullName ¶
func (repo *Repository) FullName() string
FullName returns the repository full name
func (*Repository) GetBaseRepo ¶
func (repo *Repository) GetBaseRepo(ctx context.Context) (err error)
GetBaseRepo populates repo.BaseRepo for a fork repository and returns an error on failure (NOTE: no error is returned for non-fork repositories, and BaseRepo will be left untouched)
func (*Repository) GetCommitsCountCacheKey ¶
func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string
GetCommitsCountCacheKey returns cache key used for commits count caching.
func (*Repository) GetOriginalURLHostname ¶
func (repo *Repository) GetOriginalURLHostname() string
GetOriginalURLHostname returns the hostname of a URL or the URL
func (*Repository) GetTrustModel ¶
func (repo *Repository) GetTrustModel() TrustModelType
GetTrustModel will get the TrustModel for the repo or the default trust model
func (*Repository) GetUnit ¶
GetUnit returns a RepoUnit object
func (*Repository) HTMLURL ¶
func (repo *Repository) HTMLURL(ctxs ...context.Context) string
HTMLURL returns the repository HTML URL
func (*Repository) IsBeingCreated ¶
func (repo *Repository) IsBeingCreated() bool
IsBeingCreated indicates that repository is being migrated or forked
func (*Repository) IsBeingMigrated ¶
func (repo *Repository) IsBeingMigrated() bool
IsBeingMigrated indicates that repository is being migrated
func (*Repository) IsBroken ¶
func (repo *Repository) IsBroken() bool
IsBroken indicates that repository is broken
func (*Repository) IsDependenciesEnabled ¶
func (repo *Repository) IsDependenciesEnabled(ctx context.Context) bool
IsDependenciesEnabled returns if dependencies are enabled and returns the default setting if not set.
func (*Repository) IsGenerated ¶
func (repo *Repository) IsGenerated() bool
IsGenerated returns whether _this_ repository was generated from a template
func (*Repository) IsOwnedBy ¶
func (repo *Repository) IsOwnedBy(userID int64) bool
IsOwnedBy returns true when user owns this repository
func (*Repository) IsTimetrackerEnabled ¶
func (repo *Repository) IsTimetrackerEnabled(ctx context.Context) bool
IsTimetrackerEnabled returns whether or not the timetracker is enabled. It returns the default value from config if an error occurs.
func (*Repository) Link ¶
func (repo *Repository) Link() string
Link returns the repository relative url
func (*Repository) LoadAttributes ¶
func (repo *Repository) LoadAttributes(ctx context.Context) error
LoadAttributes loads attributes of the repository.
func (*Repository) LoadOwner ¶
func (repo *Repository) LoadOwner(ctx context.Context) (err error)
LoadOwner loads owner user
func (*Repository) LoadUnits ¶
func (repo *Repository) LoadUnits(ctx context.Context) (err error)
LoadUnits loads repo units into repo.Units
func (*Repository) LogString ¶
func (repo *Repository) LogString() string
func (*Repository) MarkAsBrokenEmpty ¶
func (repo *Repository) MarkAsBrokenEmpty()
MarkAsBrokenEmpty marks the repo as broken and empty FIXME: the status "broken" and "is_empty" were abused, The code always set them together, no way to distinguish whether a repo is really "empty" or "broken"
func (*Repository) MustGetUnit ¶
MustGetUnit always returns a RepoUnit object
func (*Repository) MustNotBeArchived ¶
func (repo *Repository) MustNotBeArchived() error
MustNotBeArchived returns ErrRepoIsArchived if the repo is archived
func (*Repository) MustOwner ¶
func (repo *Repository) MustOwner(ctx context.Context) *user_model.User
MustOwner always returns a valid *user_model.User object to avoid conceptually impossible error handling. It creates a fake object that contains error details when error occurs.
func (*Repository) RelAvatarLink ¶
func (repo *Repository) RelAvatarLink(ctx context.Context) string
RelAvatarLink returns a relative link to the repository's avatar.
func (*Repository) RelativePath ¶
func (repo *Repository) RelativePath() string
RelativePath should be an unix style path like username/reponame.git
func (*Repository) RepoPath ¶
func (repo *Repository) RepoPath() string
RepoPath returns the repository path
func (*Repository) SanitizedOriginalURL ¶
func (repo *Repository) SanitizedOriginalURL() string
SanitizedOriginalURL returns a sanitized OriginalURL
func (*Repository) SizeDetails ¶
func (repo *Repository) SizeDetails() []SizeDetail
SizeDetails forms a struct with various size details about repository
func (*Repository) SizeDetailsString ¶
func (repo *Repository) SizeDetailsString() string
SizeDetailsString returns a concatenation of all repository size details as a string
func (*Repository) TemplateRepo ¶
func (repo *Repository) TemplateRepo(ctx context.Context) *Repository
TemplateRepo returns the repository, which is template of this repository
func (*Repository) UnitEnabled ¶
UnitEnabled if this repository has the given unit enabled
func (*Repository) WikiCloneLink ¶
func (repo *Repository) WikiCloneLink(ctx context.Context, doer *user_model.User) *CloneLink
WikiCloneLink returns clone URLs of repository wiki.
func (*Repository) WikiStorageRepo ¶
func (repo *Repository) WikiStorageRepo() StorageRepo
WikiStorageRepo returns the storage repo for the wiki The wiki repository should have the same object format as the code repository
type RepositoryList ¶
type RepositoryList []*Repository
RepositoryList contains a list of repositories
func GetOrgRepositories ¶
func GetOrgRepositories(ctx context.Context, orgID int64) (RepositoryList, error)
GetOrgRepositories get repos belonging to the given organization
func GetTeamRepositories ¶
func GetTeamRepositories(ctx context.Context, opts *SearchTeamRepoOptions) (RepositoryList, error)
GetRepositories returns paginated repositories in team of organization.
func GetUserRepositories ¶
func GetUserRepositories(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
GetUserRepositories returns a list of repositories of given user.
func RepositoryListOfMap ¶
func RepositoryListOfMap(repoMap map[int64]*Repository) RepositoryList
RepositoryListOfMap make list from values of map
func SearchRepository ¶
func SearchRepository(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
SearchRepository returns repositories based on search options, it returns results in given range and number of total results.
func SearchRepositoryByCondition ¶
func SearchRepositoryByCondition(ctx context.Context, opts SearchRepoOptions, cond builder.Cond, loadAttributes bool) (RepositoryList, int64, error)
SearchRepositoryByCondition search repositories by condition
func SearchRepositoryByName ¶
func SearchRepositoryByName(ctx context.Context, opts SearchRepoOptions) (RepositoryList, int64, error)
SearchRepositoryByName takes keyword and part of repository name to search, it returns results in given range and number of total results.
func (RepositoryList) IDs ¶
func (repos RepositoryList) IDs() []int64
func (RepositoryList) Len ¶
func (repos RepositoryList) Len() int
func (RepositoryList) Less ¶
func (repos RepositoryList) Less(i, j int) bool
func (RepositoryList) LoadAttributes ¶
func (repos RepositoryList) LoadAttributes(ctx context.Context) error
LoadAttributes loads the attributes for the given RepositoryList
func (RepositoryList) LoadLanguageStats ¶
func (repos RepositoryList) LoadLanguageStats(ctx context.Context) error
func (RepositoryList) LoadOwners ¶
func (repos RepositoryList) LoadOwners(ctx context.Context) error
func (RepositoryList) LoadUnits ¶
func (repos RepositoryList) LoadUnits(ctx context.Context) error
func (RepositoryList) Swap ¶
func (repos RepositoryList) Swap(i, j int)
type RepositoryStatus ¶
type RepositoryStatus int
RepositoryStatus defines the status of repository
const ( RepositoryReady RepositoryStatus = iota // a normal repository RepositoryBeingMigrated // repository is migrating RepositoryPendingTransfer // repository pending in ownership transfer state RepositoryBroken // repository is in a permanently broken state )
all kinds of RepositoryStatus
type SearchRepoOptions ¶
type SearchRepoOptions struct {
db.ListOptions
Actor *user_model.User
Keyword string
OwnerID int64
PriorityOwnerID int64
TeamID int64
OrderBy db.SearchOrderBy
Private bool // Include private repositories in results
StarredByID int64
WatchedByID int64
AllPublic bool // Include also all public repositories of users and public organisations
AllLimited bool // Include also all public repositories of limited organisations
// None -> include public and private
// True -> include just private
// False -> include just public
IsPrivate optional.Option[bool]
// None -> include collaborative AND non-collaborative
// True -> include just collaborative
// False -> include just non-collaborative
Collaborate optional.Option[bool]
// What type of unit the user can be collaborative in,
// it is ignored if Collaborate is False.
// TypeInvalid means any unit type.
UnitType unit.Type
// None -> include forks AND non-forks
// True -> include just forks
// False -> include just non-forks
Fork optional.Option[bool]
// If Fork option is True, you can use this option to limit the forks of a special repo by repo id.
ForkFrom int64
// None -> include templates AND non-templates
// True -> include just templates
// False -> include just non-templates
Template optional.Option[bool]
// None -> include mirrors AND non-mirrors
// True -> include just mirrors
// False -> include just non-mirrors
Mirror optional.Option[bool]
// None -> include archived AND non-archived
// True -> include just archived
// False -> include just non-archived
Archived optional.Option[bool]
// only search topic name
TopicOnly bool
// only search repositories with specified primary language
Language string
// include description in keyword search
IncludeDescription bool
// None -> include has milestones AND has no milestone
// True -> include just has milestones
// False -> include just has no milestone
HasMilestones optional.Option[bool]
// LowerNames represents valid lower names to restrict to
LowerNames []string
// When specified true, apply some filters over the conditions:
// - Don't show forks, when opts.Fork is OptionalBoolNone.
// - Do not display repositories that don't have a description, an icon and topics.
OnlyShowRelevant bool
}
SearchRepoOptions holds the search options
type SearchTeamRepoOptions ¶
type SearchTeamRepoOptions struct {
db.ListOptions
TeamID int64
}
type SearchWikiOptions ¶
SearchWikiOptions contains options for wiki search
type Star ¶
type Star struct {
ID int64 `xorm:"pk autoincr"`
UID int64 `xorm:"UNIQUE(s)"`
RepoID int64 `xorm:"UNIQUE(s)"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
}
Star represents a starred repo by an user.
type StarredReposOptions ¶
type StarredReposOptions struct {
db.ListOptions
StarrerID int64
RepoOwnerID int64
IncludePrivate bool
}
func (*StarredReposOptions) ToConds ¶
func (opts *StarredReposOptions) ToConds() builder.Cond
func (*StarredReposOptions) ToJoins ¶
func (opts *StarredReposOptions) ToJoins() []db.JoinFunc
type StorageRepo ¶
type StorageRepo string
func (StorageRepo) RelativePath ¶
func (sr StorageRepo) RelativePath() string
RelativePath should be an unix style path like username/reponame.git
type Topic ¶
type Topic struct {
ID int64 `xorm:"pk autoincr"`
Name string `xorm:"UNIQUE VARCHAR(50)"`
RepoCount int
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}
Topic represents a topic of repositories
func AddTopic ¶
AddTopic adds a topic name to a repository (if it does not already have it)
func DeleteTopic ¶
DeleteTopic removes a topic name from a repository (if it has it)
func GetRepoTopicByName ¶
GetRepoTopicByName retrieves topic from name for a repo if it exist
type TrustModelType ¶
type TrustModelType int
TrustModelType defines the types of trust model for this repository
const ( DefaultTrustModel TrustModelType = iota // default trust model CommitterTrustModel CollaboratorTrustModel CollaboratorCommitterTrustModel )
kinds of TrustModel
func ToTrustModel ¶
func ToTrustModel(model string) TrustModelType
ToTrustModel converts a string to a TrustModelType
func (TrustModelType) String ¶
func (t TrustModelType) String() string
String converts a TrustModelType to a string
type UnitConfig ¶
type UnitConfig struct{}
UnitConfig describes common unit config
func (*UnitConfig) FromDB ¶
func (cfg *UnitConfig) FromDB(bs []byte) error
FromDB fills up a UnitConfig from serialized format.
func (*UnitConfig) ToDB ¶
func (cfg *UnitConfig) ToDB() ([]byte, error)
ToDB exports a UnitConfig to a serialized format.
type Upload ¶
Upload represent a uploaded file to a repo to be deleted when moved
func GetUploadByUUID ¶
GetUploadByUUID returns the Upload by UUID
func GetUploadsByUUIDs ¶
GetUploadsByUUIDs returns multiple uploads by UUIDS
type UploadSession ¶
type UploadSession struct {
ID int64 `xorm:"pk autoincr"`
UUID string `xorm:"uuid UNIQUE NOT NULL"`
RepoID int64 `xorm:"INDEX NOT NULL"`
ReleaseID int64 `xorm:"INDEX"` // 0 if not a release attachment
IssueID int64 `xorm:"INDEX"` // 0 if not an issue attachment
UploaderID int64 `xorm:"INDEX NOT NULL"`
FileName string `xorm:"NOT NULL"`
FileSize int64 `xorm:"DEFAULT -1"` // -1 if unknown
ChunkSize int64 `xorm:"NOT NULL"`
ChunksExpected int64 `xorm:"DEFAULT -1"` // -1 if unknown (calculated from FileSize/ChunkSize)
ChunksReceived int64 `xorm:"DEFAULT 0"`
BytesReceived int64 `xorm:"DEFAULT 0"`
Status UploadSessionStatus `xorm:"DEFAULT 0"`
TempPath string `xorm:"NOT NULL"` // relative path to temp storage
CreatedUnix timeutil.TimeStamp `xorm:"created"`
UpdatedUnix timeutil.TimeStamp `xorm:"updated"`
ExpiresUnix timeutil.TimeStamp `xorm:"INDEX"`
}
UploadSession represents a chunked upload session for large files
func GetActiveUploadSessionsForRelease ¶
func GetActiveUploadSessionsForRelease(ctx context.Context, releaseID int64) ([]*UploadSession, error)
GetActiveUploadSessionsForRelease returns active upload sessions for a release
func GetExpiredUploadSessions ¶
func GetExpiredUploadSessions(ctx context.Context) ([]*UploadSession, error)
GetExpiredUploadSessions returns all expired upload sessions
func GetUploadSessionByID ¶
func GetUploadSessionByID(ctx context.Context, id int64) (*UploadSession, error)
GetUploadSessionByID returns an upload session by ID
func GetUploadSessionByUUID ¶
func GetUploadSessionByUUID(ctx context.Context, uuid string) (*UploadSession, error)
GetUploadSessionByUUID returns an upload session by UUID
func GetUploadSessionsForUser ¶
func GetUploadSessionsForUser(ctx context.Context, userID int64) ([]*UploadSession, error)
GetUploadSessionsForUser returns all upload sessions for a user
func (*UploadSession) CalculateChunksExpected ¶
func (s *UploadSession) CalculateChunksExpected() int64
CalculateChunksExpected calculates the expected number of chunks based on file size
func (*UploadSession) GetChunkPath ¶
func (s *UploadSession) GetChunkPath(chunkNumber int64) string
GetChunkPath returns the path to a specific chunk file
func (*UploadSession) GetTempPath ¶
func (s *UploadSession) GetTempPath() string
GetTempPath returns the full path to the temp directory for this session
func (*UploadSession) IsComplete ¶
func (s *UploadSession) IsComplete() bool
IsComplete checks if all chunks have been received
func (*UploadSession) IsExpired ¶
func (s *UploadSession) IsExpired() bool
IsExpired checks if the session has expired
type UploadSessionStatus ¶
type UploadSessionStatus int
UploadSessionStatus represents the status of an upload session
const ( // UploadSessionStatusActive indicates the session is active and accepting chunks UploadSessionStatusActive UploadSessionStatus = iota // UploadSessionStatusComplete indicates all chunks have been received UploadSessionStatusComplete // UploadSessionStatusExpired indicates the session has expired UploadSessionStatusExpired // UploadSessionStatusFailed indicates the upload failed UploadSessionStatusFailed )
type Watch ¶
type Watch struct {
ID int64 `xorm:"pk autoincr"`
UserID int64 `xorm:"UNIQUE(watch)"`
RepoID int64 `xorm:"UNIQUE(watch)"`
Mode WatchMode `xorm:"SMALLINT NOT NULL DEFAULT 1"`
CreatedUnix timeutil.TimeStamp `xorm:"INDEX created"`
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
}
Watch is connection request for receiving repository notification.
func GetWatch ¶
GetWatch gets what kind of subscription a user has on a given repository; returns dummy record if none found
type WatchMode ¶
type WatchMode int8
WatchMode specifies what kind of watch the user has on a repository
type WatchedReposOptions ¶
type WatchedReposOptions struct {
db.ListOptions
WatcherID int64
RepoOwnerID int64
IncludePrivate bool
}
func (*WatchedReposOptions) ToConds ¶
func (opts *WatchedReposOptions) ToConds() builder.Cond
func (*WatchedReposOptions) ToJoins ¶
func (opts *WatchedReposOptions) ToJoins() []db.JoinFunc
type WikiIndex ¶
type WikiIndex struct {
ID int64 `xorm:"pk autoincr"`
RepoID int64 `xorm:"INDEX NOT NULL"`
PageName string `xorm:"VARCHAR(255) NOT NULL"`
PagePath string `xorm:"VARCHAR(512) NOT NULL"` // Git path
Title string `xorm:"VARCHAR(255)"`
Content string `xorm:"LONGTEXT"` // Full content for search
ContentHash string `xorm:"VARCHAR(64)"` // For change detection
CommitSHA string `xorm:"VARCHAR(64)"` // Last indexed commit
WordCount int `xorm:"DEFAULT 0"`
LinksOut string `xorm:"TEXT"` // JSON array of outgoing links
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
CreatedUnix timeutil.TimeStamp `xorm:"created"`
}
WikiIndex stores the searchable index for wiki pages
func GetWikiIndex ¶
GetWikiIndex returns the wiki index for a specific page
func GetWikiIndexByRepo ¶
GetWikiIndexByRepo returns all indexed pages for a repository
func SearchWikiPages ¶
SearchWikiPages searches wiki pages by content
Source Files
¶
- archiver.go
- attachment.go
- avatar.go
- collaboration.go
- fork.go
- git.go
- issue.go
- language_stats.go
- license.go
- mirror.go
- org_repo.go
- pages.go
- pushmirror.go
- redirect.go
- release.go
- repo.go
- repo_indexer.go
- repo_list.go
- repo_unit.go
- search.go
- star.go
- topic.go
- transfer.go
- update.go
- upload.go
- upload_session.go
- user_repo.go
- watch.go
- wiki.go
- wiki_ai.go