Documentation

Index

Constants

View Source
const (
	// BadSignature is used as the reason when the signature has a KeyID that is in the db
	// but no key that has that ID verifies the signature. This is a suspicious failure.
	BadSignature = "gpg.error.probable_bad_signature"
	// BadDefaultSignature is used as the reason when the signature has a KeyID that matches the
	// default Key but is not verified by the default key. This is a suspicious failure.
	BadDefaultSignature = "gpg.error.probable_bad_default_signature"
	// NoKeyFound is used as the reason when no key can be found to verify the signature.
	NoKeyFound = "gpg.error.no_gpg_keys_found"
)
View Source
const (
	EnvRepoName     = "GITEA_REPO_NAME"
	EnvRepoUsername = "GITEA_REPO_USER_NAME"
	EnvRepoID       = "GITEA_REPO_ID"
	EnvRepoIsWiki   = "GITEA_REPO_IS_WIKI"
	EnvPusherName   = "GITEA_PUSHER_NAME"
	EnvPusherEmail  = "GITEA_PUSHER_EMAIL"
	EnvPusherID     = "GITEA_PUSHER_ID"
	EnvKeyID        = "GITEA_KEY_ID"
	EnvIsDeployKey  = "GITEA_IS_DEPLOY_KEY"
	EnvPRID         = "GITEA_PR_ID"
	EnvIsInternal   = "GITEA_INTERNAL_PUSH"
	EnvAppURL       = "GITEA_ROOT_URL"
)

    env keys for git hooks need

    View Source
    const (
    	FilterModeAll = iota
    	FilterModeAssign
    	FilterModeCreate
    	FilterModeMention
    )

      Filter modes.

      View Source
      const (
      	// LFSMetaFileIdentifier is the string appearing at the first line of LFS pointer files.
      	// https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md
      	LFSMetaFileIdentifier = "version https://git-lfs.github.com/spec/v1"
      
      	// LFSMetaFileOidPrefix appears in LFS pointer files on a line before the sha256 hash.
      	LFSMetaFileOidPrefix = "oid sha256:"
      )
      View Source
      const (
      	SMTPPlain = "PLAIN"
      	SMTPLogin = "LOGIN"
      )

        SMTP authentication type names.

        View Source
        const (
        	// KeyTypeUser specifies the user key
        	KeyTypeUser = iota + 1
        	// KeyTypeDeploy specifies the deploy key
        	KeyTypeDeploy
        	// KeyTypePrincipal specifies the authorized principal key
        	KeyTypePrincipal
        )
        View Source
        const (
        
        	// EmailNotificationsEnabled indicates that the user would like to receive all email notifications
        	EmailNotificationsEnabled = "enabled"
        	// EmailNotificationsOnMention indicates that the user would like to be notified via email when mentioned.
        	EmailNotificationsOnMention = "onmention"
        	// EmailNotificationsDisabled indicates that the user would not like to be notified via email.
        	EmailNotificationsDisabled = "disabled"
        )
        View Source
        const (
        	HookStatusNone = iota
        	HookStatusSucceed
        	HookStatusFail
        )

          Possible statuses of a web hook

          View Source
          const NonexistentID = int64(math.MaxInt64)

            NonexistentID an ID that will never exist

            View Source
            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

              View Source
              var (
              	// ErrMirrorNotExist mirror does not exist error
              	ErrMirrorNotExist = errors.New("Mirror does not exist")
              
              	// ErrNameEmpty name is empty error
              	ErrNameEmpty = errors.New("Name is empty")
              )
              View Source
              var (
              	// Gitignores contains the gitiginore files
              	Gitignores []string
              
              	// Licenses contains the license files
              	Licenses []string
              
              	// Readmes contains the readme files
              	Readmes []string
              
              	// LabelTemplates contains the label template files and the list of labels for each file
              	LabelTemplates map[string]string
              
              	// ItemsPerPage maximum items per page in forks, watchers and stars of a repo
              	ItemsPerPage = 40
              )
              View Source
              var (
              	// AllRepoUnitTypes contains all the unit types
              	AllRepoUnitTypes = []UnitType{
              		UnitTypeCode,
              		UnitTypeIssues,
              		UnitTypePullRequests,
              		UnitTypeReleases,
              		UnitTypeWiki,
              		UnitTypeExternalWiki,
              		UnitTypeExternalTracker,
              		UnitTypeProjects,
              	}
              
              	// DefaultRepoUnits contains the default unit types
              	DefaultRepoUnits = []UnitType{
              		UnitTypeCode,
              		UnitTypeIssues,
              		UnitTypePullRequests,
              		UnitTypeReleases,
              		UnitTypeWiki,
              		UnitTypeProjects,
              	}
              
              	// NotAllowedDefaultRepoUnits contains units that can't be default
              	NotAllowedDefaultRepoUnits = []UnitType{
              		UnitTypeExternalWiki,
              		UnitTypeExternalTracker,
              	}
              
              	// MustRepoUnits contains the units could not be disabled currently
              	MustRepoUnits = []UnitType{
              		UnitTypeCode,
              		UnitTypeReleases,
              	}
              
              	// DisabledRepoUnits contains the units that have been globally disabled
              	DisabledRepoUnits = []UnitType{}
              )
              View Source
              var (
              	UnitCode = Unit{
              		UnitTypeCode,
              		"repo.code",
              		"/",
              		"repo.code.desc",
              		0,
              	}
              
              	UnitIssues = Unit{
              		UnitTypeIssues,
              		"repo.issues",
              		"/issues",
              		"repo.issues.desc",
              		1,
              	}
              
              	UnitExternalTracker = Unit{
              		UnitTypeExternalTracker,
              		"repo.ext_issues",
              		"/issues",
              		"repo.ext_issues.desc",
              		1,
              	}
              
              	UnitPullRequests = Unit{
              		UnitTypePullRequests,
              		"repo.pulls",
              		"/pulls",
              		"repo.pulls.desc",
              		2,
              	}
              
              	UnitReleases = Unit{
              		UnitTypeReleases,
              		"repo.releases",
              		"/releases",
              		"repo.releases.desc",
              		3,
              	}
              
              	UnitWiki = Unit{
              		UnitTypeWiki,
              		"repo.wiki",
              		"/wiki",
              		"repo.wiki.desc",
              		4,
              	}
              
              	UnitExternalWiki = Unit{
              		UnitTypeExternalWiki,
              		"repo.ext_wiki",
              		"/wiki",
              		"repo.ext_wiki.desc",
              		4,
              	}
              
              	UnitProjects = Unit{
              		UnitTypeProjects,
              		"repo.projects",
              		"/projects",
              		"repo.projects.desc",
              		5,
              	}
              
              	// Units contains all the units
              	Units = map[UnitType]Unit{
              		UnitTypeCode:            UnitCode,
              		UnitTypeIssues:          UnitIssues,
              		UnitTypeExternalTracker: UnitExternalTracker,
              		UnitTypePullRequests:    UnitPullRequests,
              		UnitTypeReleases:        UnitReleases,
              		UnitTypeWiki:            UnitWiki,
              		UnitTypeExternalWiki:    UnitExternalWiki,
              		UnitTypeProjects:        UnitProjects,
              	}
              )

                Enumerate all the units

                View Source
                var (
                	// ErrUserNotKeyOwner user does not own this key error
                	ErrUserNotKeyOwner = errors.New("User does not own this public key")
                
                	// ErrEmailNotExist e-mail does not exist error
                	ErrEmailNotExist = errors.New("E-mail does not exist")
                
                	// ErrEmailNotActivated e-mail address has not been activated error
                	ErrEmailNotActivated = errors.New("E-mail address has not been activated")
                
                	// ErrUserNameIllegal user name contains illegal characters error
                	ErrUserNameIllegal = errors.New("User name contains illegal characters")
                
                	// ErrLoginSourceNotActived login source is not actived error
                	ErrLoginSourceNotActived = errors.New("Login source is not actived")
                
                	// ErrUnsupportedLoginType login source is unknown error
                	ErrUnsupportedLoginType = errors.New("Login source is unknown")
                )
                View Source
                var (
                	// ErrEmailAddressNotExist email address not exist
                	ErrEmailAddressNotExist = errors.New("Email address does not exist")
                )
                View Source
                var (
                	// ErrLFSObjectNotExist is returned from lfs models functions in order
                	// to differentiate between database and missing object errors.
                	ErrLFSObjectNotExist = errors.New("LFS Meta object does not exist")
                )
                View Source
                var (
                	// ErrOpenIDNotExist openid is not known
                	ErrOpenIDNotExist = errors.New("OpenID is unknown")
                )
                View Source
                var (
                
                	// HasEngine specifies if we have a xorm.Engine
                	HasEngine bool
                )
                View Source
                var LabelColorPattern = regexp.MustCompile("^#[0-9a-fA-F]{6}$")

                  LabelColorPattern is a regexp witch can validate LabelColor

                  View Source
                  var LoginNames = map[LoginType]string{
                  	LoginLDAP:   "LDAP (via BindDN)",
                  	LoginDLDAP:  "LDAP (simple auth)",
                  	LoginSMTP:   "SMTP",
                  	LoginPAM:    "PAM",
                  	LoginOAuth2: "OAuth2",
                  	LoginSSPI:   "SPNEGO with SSPI",
                  }

                    LoginNames contains the name of LoginType values.

                    View Source
                    var OAuth2DefaultCustomURLMappings = map[string]*oauth2.CustomURLMapping{
                    	"github":    OAuth2Providers["github"].CustomURLMapping,
                    	"gitlab":    OAuth2Providers["gitlab"].CustomURLMapping,
                    	"gitea":     OAuth2Providers["gitea"].CustomURLMapping,
                    	"nextcloud": OAuth2Providers["nextcloud"].CustomURLMapping,
                    }

                      OAuth2DefaultCustomURLMappings contains the map of default URL's for OAuth2 providers that are allowed to have custom urls key is used to map the OAuth2Provider value is the mapping as defined for the OAuth2Provider

                      View Source
                      var OAuth2Providers = map[string]OAuth2Provider{
                      	"bitbucket": {Name: "bitbucket", DisplayName: "Bitbucket", Image: "/img/auth/bitbucket.png"},
                      	"dropbox":   {Name: "dropbox", DisplayName: "Dropbox", Image: "/img/auth/dropbox.png"},
                      	"facebook":  {Name: "facebook", DisplayName: "Facebook", Image: "/img/auth/facebook.png"},
                      	"github": {Name: "github", DisplayName: "GitHub", Image: "/img/auth/github.png",
                      		CustomURLMapping: &oauth2.CustomURLMapping{
                      			TokenURL:   oauth2.GetDefaultTokenURL("github"),
                      			AuthURL:    oauth2.GetDefaultAuthURL("github"),
                      			ProfileURL: oauth2.GetDefaultProfileURL("github"),
                      			EmailURL:   oauth2.GetDefaultEmailURL("github"),
                      		},
                      	},
                      	"gitlab": {Name: "gitlab", DisplayName: "GitLab", Image: "/img/auth/gitlab.png",
                      		CustomURLMapping: &oauth2.CustomURLMapping{
                      			TokenURL:   oauth2.GetDefaultTokenURL("gitlab"),
                      			AuthURL:    oauth2.GetDefaultAuthURL("gitlab"),
                      			ProfileURL: oauth2.GetDefaultProfileURL("gitlab"),
                      		},
                      	},
                      	"gplus":         {Name: "gplus", DisplayName: "Google", Image: "/img/auth/google.png"},
                      	"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.svg"},
                      	"twitter":       {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"},
                      	"discord":       {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"},
                      	"gitea": {Name: "gitea", DisplayName: "Gitea", Image: "/img/auth/gitea.png",
                      		CustomURLMapping: &oauth2.CustomURLMapping{
                      			TokenURL:   oauth2.GetDefaultTokenURL("gitea"),
                      			AuthURL:    oauth2.GetDefaultAuthURL("gitea"),
                      			ProfileURL: oauth2.GetDefaultProfileURL("gitea"),
                      		},
                      	},
                      	"nextcloud": {Name: "nextcloud", DisplayName: "Nextcloud", Image: "/img/auth/nextcloud.png",
                      		CustomURLMapping: &oauth2.CustomURLMapping{
                      			TokenURL:   oauth2.GetDefaultTokenURL("nextcloud"),
                      			AuthURL:    oauth2.GetDefaultAuthURL("nextcloud"),
                      			ProfileURL: oauth2.GetDefaultProfileURL("nextcloud"),
                      		},
                      	},
                      	"yandex": {Name: "yandex", DisplayName: "Yandex", Image: "/img/auth/yandex.png"},
                      }

                        OAuth2Providers contains the map of registered OAuth2 providers in Gitea (based on goth) key is used to map the OAuth2Provider with the goth provider type (also in LoginSource.OAuth2Config.Provider) value is used to store display data

                        View Source
                        var SMTPAuths = []string{SMTPPlain, SMTPLogin}

                          SMTPAuths contains available SMTP authentication type names.

                          View Source
                          var SecurityProtocolNames = map[ldap.SecurityProtocol]string{
                          	ldap.SecurityProtocolUnencrypted: "Unencrypted",
                          	ldap.SecurityProtocolLDAPS:       "LDAPS",
                          	ldap.SecurityProtocolStartTLS:    "StartTLS",
                          }

                            SecurityProtocolNames contains the name of SecurityProtocol values.

                            Functions

                            func AccessTokenByNameExists

                            func AccessTokenByNameExists(token *AccessToken) (bool, error)

                              AccessTokenByNameExists checks if a token name has been used already by a user.

                              func AccessibleRepoIDsQuery

                              func AccessibleRepoIDsQuery(user *User) *builder.Builder

                                AccessibleRepoIDsQuery queries accessible repository ids. Usable as a subquery wherever repo ids need to be filtered.

                                func ActivateUserEmail

                                func ActivateUserEmail(userID int64, email string, primary, activate bool) (err error)

                                  ActivateUserEmail will change the activated state of an email address, either primary (in the user table) or secondary (in the email_address table)

                                  func AddDeletePRBranchComment

                                  func AddDeletePRBranchComment(doer *User, repo *Repository, issueID int64, branchName string) error

                                    AddDeletePRBranchComment adds delete branch comment for pull request issue

                                    func AddEmailAddress

                                    func AddEmailAddress(email *EmailAddress) error

                                      AddEmailAddress adds an email address to given user.

                                      func AddEmailAddresses

                                      func AddEmailAddresses(emails []*EmailAddress) error

                                        AddEmailAddresses adds an email address to given user.

                                        func AddOrgUser

                                        func AddOrgUser(orgID, uid int64) error

                                          AddOrgUser adds new user to given organization.

                                          func AddReleaseAttachments

                                          func AddReleaseAttachments(releaseID int64, attachmentUUIDs []string) (err error)

                                            AddReleaseAttachments adds a release attachments

                                            func AddTeamMember

                                            func AddTeamMember(team *Team, userID int64) error

                                              AddTeamMember adds new membership of given team to given organization, the user will have membership to given organization automatically when needed.

                                              func AddUserOpenID

                                              func AddUserOpenID(openid *UserOpenID) error

                                                AddUserOpenID adds an pre-verified/normalized OpenID URI to given user.

                                                func AssertCount

                                                func AssertCount(t testing.TB, bean interface{}, expected interface{})

                                                  AssertCount assert the count of a bean

                                                  func AssertExistsAndLoadBean

                                                  func AssertExistsAndLoadBean(t testing.TB, bean interface{}, conditions ...interface{}) interface{}

                                                    AssertExistsAndLoadBean assert that a bean exists and load it from the test database

                                                    func AssertExistsIf

                                                    func AssertExistsIf(t *testing.T, expected bool, bean interface{}, conditions ...interface{})

                                                      AssertExistsIf asserts that a bean exists or does not exist, depending on what is expected.

                                                      func AssertInt64InRange

                                                      func AssertInt64InRange(t testing.TB, low, high, value int64)

                                                        AssertInt64InRange assert value is in range [low, high]

                                                        func AssertNotExistsBean

                                                        func AssertNotExistsBean(t testing.TB, bean interface{}, conditions ...interface{})

                                                          AssertNotExistsBean assert that a bean does not exist in the test database

                                                          func AssertSuccessfulInsert

                                                          func AssertSuccessfulInsert(t testing.TB, beans ...interface{})

                                                            AssertSuccessfulInsert assert that beans is successfully inserted

                                                            func AttachmentRelativePath

                                                            func AttachmentRelativePath(uuid string) string

                                                              AttachmentRelativePath returns the relative path

                                                              func AvatarLink(email string) string

                                                                AvatarLink returns an avatar link for a provided email

                                                                func BeanExists

                                                                func BeanExists(t testing.TB, bean interface{}, conditions ...interface{}) bool

                                                                  BeanExists for testing, check if a bean exists

                                                                  func BuildLabelNamesIssueIDsCondition

                                                                  func BuildLabelNamesIssueIDsCondition(labelNames []string) *builder.Builder

                                                                    BuildLabelNamesIssueIDsCondition returns a builder where get issue ids match label names

                                                                    func CalculateTrustStatus

                                                                    func CalculateTrustStatus(verification *CommitVerification, repository *Repository, keyMap *map[string]bool) (err error)

                                                                      CalculateTrustStatus will calculate the TrustStatus for a commit verification within a repository

                                                                      func CanBeAssigned

                                                                      func CanBeAssigned(user *User, repo *Repository, isPull bool) (bool, error)

                                                                        CanBeAssigned return true if user can be assigned to issue or pull requests in repo Currently any write access (code, issues or pr's) is assignable, to match assignee list in user interface. FIXME: user could send PullRequest also could be assigned???

                                                                        func CanCreateOrgRepo

                                                                        func CanCreateOrgRepo(orgID, uid int64) (bool, error)

                                                                          CanCreateOrgRepo returns true if user can create repo in organization

                                                                          func CanMarkConversation

                                                                          func CanMarkConversation(issue *Issue, doer *User) (permResult bool, err error)

                                                                            CanMarkConversation Add or remove Conversation mark for a code comment permission check the PR writer , offfcial reviewer and poster can do it

                                                                            func CancelStopwatch

                                                                            func CancelStopwatch(user *User, issue *Issue) error

                                                                              CancelStopwatch removes the given stopwatch and logs it into issue's timeline.

                                                                              func Cell2Int64

                                                                              func Cell2Int64(val xorm.Cell) int64

                                                                                Cell2Int64 converts a xorm.Cell type to int64, and handles possible irregular cases.

                                                                                func ChangeMilestoneAssign

                                                                                func ChangeMilestoneAssign(issue *Issue, doer *User, oldMilestoneID int64) (err error)

                                                                                  ChangeMilestoneAssign changes assignment of milestone for issue.

                                                                                  func ChangeMilestoneStatus

                                                                                  func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error)

                                                                                    ChangeMilestoneStatus changes the milestone open/closed status.

                                                                                    func ChangeMilestoneStatusByRepoIDAndID

                                                                                    func ChangeMilestoneStatusByRepoIDAndID(repoID, milestoneID int64, isClosed bool) error

                                                                                      ChangeMilestoneStatusByRepoIDAndID changes a milestone open/closed status if the milestone ID is in the repo.

                                                                                      func ChangeOrgUserStatus

                                                                                      func ChangeOrgUserStatus(orgID, uid int64, public bool) error

                                                                                        ChangeOrgUserStatus changes public or private membership status.

                                                                                        func ChangeProjectAssign

                                                                                        func ChangeProjectAssign(issue *Issue, doer *User, newProjectID int64) error

                                                                                          ChangeProjectAssign changes the project associated with an issue

                                                                                          func ChangeProjectStatus

                                                                                          func ChangeProjectStatus(p *Project, isClosed bool) error

                                                                                            ChangeProjectStatus toggle a project between opened and closed

                                                                                            func ChangeProjectStatusByRepoIDAndID

                                                                                            func ChangeProjectStatusByRepoIDAndID(repoID, projectID int64, isClosed bool) error

                                                                                              ChangeProjectStatusByRepoIDAndID toggles a project between opened and closed

                                                                                              func ChangeRepositoryName

                                                                                              func ChangeRepositoryName(doer *User, repo *Repository, newRepoName string) (err error)

                                                                                                ChangeRepositoryName changes all corresponding setting from old repository name to new one.

                                                                                                func ChangeUserName

                                                                                                func ChangeUserName(u *User, newUserName string) (err error)

                                                                                                  ChangeUserName changes all corresponding setting from old user name to new one.

                                                                                                  func CheckConsistencyFor

                                                                                                  func CheckConsistencyFor(t *testing.T, beansToCheck ...interface{})

                                                                                                    CheckConsistencyFor test that all matching database entries are consistent

                                                                                                    func CheckConsistencyForAll

                                                                                                    func CheckConsistencyForAll(t *testing.T)

                                                                                                      CheckConsistencyForAll test that the entire database is consistent

                                                                                                      func CheckCreateRepository

                                                                                                      func CheckCreateRepository(doer, u *User, name string, overwriteOrAdopt bool) error

                                                                                                        CheckCreateRepository check if could created a repository

                                                                                                        func CheckIssueWatch

                                                                                                        func CheckIssueWatch(user *User, issue *Issue) (bool, error)

                                                                                                          CheckIssueWatch check if an user is watching an issue it takes participants and repo watch into account

                                                                                                          func CheckLFSAccessForRepo

                                                                                                          func CheckLFSAccessForRepo(u *User, repo *Repository, mode AccessMode) error

                                                                                                            CheckLFSAccessForRepo check needed access mode base on action

                                                                                                            func CheckPrincipalKeyString

                                                                                                            func CheckPrincipalKeyString(user *User, content string) (_ string, err error)

                                                                                                              CheckPrincipalKeyString strips spaces and returns an error if the given principal contains newlines

                                                                                                              func CheckPublicKeyString

                                                                                                              func CheckPublicKeyString(content string) (_ string, err error)

                                                                                                                CheckPublicKeyString checks if the given public key string is recognized by SSH. It returns the actual public key line on success.

                                                                                                                func CheckRepoStats

                                                                                                                func CheckRepoStats(ctx context.Context) error

                                                                                                                  CheckRepoStats checks the repository stats

                                                                                                                  func CommentHashTag

                                                                                                                  func CommentHashTag(id int64) string

                                                                                                                    CommentHashTag returns unique hash tag for comment id.

                                                                                                                    func CommentTypeIsRef

                                                                                                                    func CommentTypeIsRef(t CommentType) bool

                                                                                                                      CommentTypeIsRef returns true if CommentType is a reference from another issue

                                                                                                                      func ComposeHTTPSCloneURL

                                                                                                                      func ComposeHTTPSCloneURL(owner, repo string) string

                                                                                                                        ComposeHTTPSCloneURL returns HTTPS clone URL based on given owner and repository name.

                                                                                                                        func Cond

                                                                                                                        func Cond(query interface{}, args ...interface{}) interface{}

                                                                                                                          Cond create a condition with arguments for a test

                                                                                                                          func ConvertUtf8ToUtf8mb4

                                                                                                                          func ConvertUtf8ToUtf8mb4() error

                                                                                                                            ConvertUtf8ToUtf8mb4 converts database and tables from utf8 to utf8mb4 if it's mysql and set ROW_FORMAT=dynamic

                                                                                                                            func CopyLFS

                                                                                                                            func CopyLFS(ctx DBContext, newRepo, oldRepo *Repository) error

                                                                                                                              CopyLFS copies LFS data from one repo to another

                                                                                                                              func CopyLanguageStat

                                                                                                                              func CopyLanguageStat(originalRepo, destRepo *Repository) error

                                                                                                                                CopyLanguageStat Copy originalRepo language stat information to destRepo (use for forked repo)

                                                                                                                                func Count

                                                                                                                                func Count(bean interface{}) (int64, error)

                                                                                                                                  Count returns records number according struct's fields as database query conditions

                                                                                                                                  func CountIssues

                                                                                                                                  func CountIssues(opts *IssuesOptions) (int64, error)

                                                                                                                                    CountIssues number return of issues by given conditions.

                                                                                                                                    func CountIssuesByRepo

                                                                                                                                    func CountIssuesByRepo(opts *IssuesOptions) (map[int64]int64, error)

                                                                                                                                      CountIssuesByRepo map from repoID to number of issues matching the options

                                                                                                                                      func CountLFSLockByRepoID

                                                                                                                                      func CountLFSLockByRepoID(repoID int64) (int64, error)

                                                                                                                                        CountLFSLockByRepoID returns a count of all LFSLocks associated with a repository.

                                                                                                                                        func CountLoginSources

                                                                                                                                        func CountLoginSources() int64

                                                                                                                                          CountLoginSources returns number of login sources.

                                                                                                                                          func CountMilestonesByRepoCond

                                                                                                                                          func CountMilestonesByRepoCond(repoCond builder.Cond, isClosed bool) (map[int64]int64, error)

                                                                                                                                            CountMilestonesByRepoCond map from repo conditions to number of milestones matching the options`

                                                                                                                                            func CountNotices

                                                                                                                                            func CountNotices() int64

                                                                                                                                              CountNotices returns number of notices.

                                                                                                                                              func CountNullArchivedRepository

                                                                                                                                              func CountNullArchivedRepository() (int64, error)

                                                                                                                                                CountNullArchivedRepository counts the number of repositories with is_archived is null

                                                                                                                                                func CountOrgMembers

                                                                                                                                                func CountOrgMembers(opts FindOrgMembersOpts) (int64, error)

                                                                                                                                                  CountOrgMembers counts the organization's members

                                                                                                                                                  func CountOrganizations

                                                                                                                                                  func CountOrganizations() int64

                                                                                                                                                    CountOrganizations returns number of organizations.

                                                                                                                                                    func CountOrphanedIssues

                                                                                                                                                    func CountOrphanedIssues() (int64, error)

                                                                                                                                                      CountOrphanedIssues count issues without a repo

                                                                                                                                                      func CountOrphanedLabels

                                                                                                                                                      func CountOrphanedLabels() (int64, error)

                                                                                                                                                        CountOrphanedLabels return count of labels witch are broken and not accessible via ui anymore

                                                                                                                                                        func CountOrphanedObjects

                                                                                                                                                        func CountOrphanedObjects(subject, refobject, joinCond string) (int64, error)

                                                                                                                                                          CountOrphanedObjects count subjects with have no existing refobject anymore

                                                                                                                                                          func CountRepoClosedMilestones

                                                                                                                                                          func CountRepoClosedMilestones(repoID int64) (int64, error)

                                                                                                                                                            CountRepoClosedMilestones returns number of closed milestones in given repository.

                                                                                                                                                            func CountRepositories

                                                                                                                                                            func CountRepositories(private bool) int64

                                                                                                                                                              CountRepositories returns number of repositories. Argument private only takes effect when it is false, set it true to count all repositories.

                                                                                                                                                              func CountUnread

                                                                                                                                                              func CountUnread(user *User) int64

                                                                                                                                                                CountUnread count unread notifications for a user

                                                                                                                                                                func CountUserRepositories

                                                                                                                                                                func CountUserRepositories(userID int64, private bool) int64

                                                                                                                                                                  CountUserRepositories returns number of repositories user owns. Argument private only takes effect when it is false, set it true to count all repositories.

                                                                                                                                                                  func CountUsers

                                                                                                                                                                  func CountUsers() int64

                                                                                                                                                                    CountUsers returns number of users.

                                                                                                                                                                    func CreateHookTask

                                                                                                                                                                    func CreateHookTask(t *HookTask) error

                                                                                                                                                                      CreateHookTask creates a new hook task, it handles conversion from Payload to PayloadContent.

                                                                                                                                                                      func CreateIssueDependency

                                                                                                                                                                      func CreateIssueDependency(user *User, issue, dep *Issue) error

                                                                                                                                                                        CreateIssueDependency creates a new dependency for an issue

                                                                                                                                                                        func CreateLoginSource

                                                                                                                                                                        func CreateLoginSource(source *LoginSource) error

                                                                                                                                                                          CreateLoginSource inserts a LoginSource in the DB if not already existing with the given name.

                                                                                                                                                                          func CreateNotice

                                                                                                                                                                          func CreateNotice(tp NoticeType, desc string, args ...interface{}) error

                                                                                                                                                                            CreateNotice creates new system notice.

                                                                                                                                                                            func CreateOrStopIssueStopwatch

                                                                                                                                                                            func CreateOrStopIssueStopwatch(user *User, issue *Issue) error

                                                                                                                                                                              CreateOrStopIssueStopwatch will create or remove a stopwatch and will log it into issue's timeline.

                                                                                                                                                                              func CreateOrUpdateIssueNotifications

                                                                                                                                                                              func CreateOrUpdateIssueNotifications(issueID, commentID, notificationAuthorID, receiverID int64) error

                                                                                                                                                                                CreateOrUpdateIssueNotifications creates an issue notification for each watcher, or updates it if already exists receiverID > 0 just send to reciver, else send to all watcher