Documentation ¶
Index ¶
- Constants
- Variables
- func AddDeployKey(repoID int64, name, content string) (err error)
- func AddEmailAddress(email *EmailAddress) error
- func AddOrgUser(orgId, uid int64) error
- func AddPublicKey(ownerID int64, name, content string) (err error)
- func AddTeamMember(orgId, teamId, uid int64) error
- func AddTeamRepo(orgID, teamID, repoID int64) error
- func AddUpdateTask(task *UpdateTask) error
- func AttachmentLocalPath(uuid string) string
- func ChangeMilestoneAssign(oldMid int64, issue *Issue) (err error)
- func ChangeMilestoneIssueStats(issue *Issue) (err error)
- func ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error)
- func ChangeOrgUserStatus(orgId, uid int64, public bool) error
- func ChangeRepositoryName(u *User, oldRepoName, newRepoName string) (err error)
- func ChangeUserName(u *User, newUserName string) (err error)
- func CheckPublicKeyString(content string) (_ string, err error)
- func CheckRepoStats()
- func CommitRepoAction(userID, repoUserID int64, userName, actEmail string, repoID int64, ...) error
- func CountLoginSources() int64
- func CountNotices() int64
- func CountOrganizations() int64
- func CountPublicRepositories() int64
- func CountRepoClosedMilestones(repoID int64) int64
- func CountRepoMilestones(repoID int64) int64
- func CountRepositories() int64
- func CountUsers() int64
- func CreateHookTask(t *HookTask) error
- func CreateNotice(tp NoticeType, desc string) error
- func CreateOrganization(org, owner *User) (err error)
- func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error
- func CreateRelease(gitRepo *git.Repository, rel *Release) error
- func CreateRepositoryNotice(desc string) error
- func CreateSource(source *LoginSource) error
- func CreateUser(u *User) (err error)
- func CreateWebhook(w *Webhook) error
- func DelUpdateTasksByUuid(uuid string) error
- func DeleteAccessTokenByID(id int64) error
- func DeleteAttachment(a *Attachment, remove bool) error
- func DeleteAttachments(attachments []*Attachment, remove bool) (int, error)
- func DeleteAttachmentsByComment(commentId int64, remove bool) (int, error)
- func DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error)
- func DeleteDeployKey(id int64) error
- func DeleteEmailAddress(email *EmailAddress) error
- func DeleteInactivateUsers() (err error)
- func DeleteIssueLabel(issue *Issue, label *Label) (err error)
- func DeleteLabel(repoID, labelID int64) error
- func DeleteMilestoneByID(mid int64) error
- func DeleteNotice(id int64) error
- func DeleteOrganization(org *User) (err error)
- func DeletePublicKey(id int64) (err error)
- func DeleteRepository(uid, repoID int64) error
- func DeleteRepositoryArchives() error
- func DeleteSource(source *LoginSource) error
- func DeleteTeam(t *Team) error
- func DeleteUser(u *User) (err error)
- func DeleteWebhook(id int64) (err error)
- func DeliverHooks()
- func DumpDatabase(filePath string) error
- func FollowUser(userId int64, followId int64) (err error)
- func GetIssueCountByPoster(uid, rid int64, isClosed bool) int64
- func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)
- func GetRepositoryCount(u *User) (int64, error)
- func GetUserEmailsByNames(names []string) []string
- func GetUserIdsByNames(names []string) []int64
- func GetUserSalt() string
- func GitFsck()
- func GitGcRepos() error
- func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error)
- func HasDeployKey(keyID, repoID int64) bool
- func HasIssueLabel(issueID, labelID int64) bool
- func HasTeamRepo(orgID, teamID, repoID int64) bool
- func InitDeliverHooks()
- func IsEmailUsed(email string) (bool, error)
- func IsErrAccessTokenNotExist(err error) bool
- func IsErrAttachmentNotExist(err error) bool
- func IsErrCommentNotExist(err error) bool
- func IsErrDeployKeyAlreadyExist(err error) bool
- func IsErrDeployKeyNameAlreadyUsed(err error) bool
- func IsErrEmailAlreadyUsed(err error) bool
- func IsErrIssueNotExist(err error) bool
- func IsErrKeyAlreadyExist(err error) bool
- func IsErrKeyNameAlreadyUsed(err error) bool
- func IsErrKeyNotExist(err error) bool
- func IsErrLabelNotExist(err error) bool
- func IsErrLastOrgOwner(err error) bool
- func IsErrMilestoneNotExist(err error) bool
- func IsErrNamePatternNotAllowed(err error) bool
- func IsErrNameReserved(err error) bool
- func IsErrPullRequestNotExist(err error) bool
- func IsErrRepoAlreadyExist(err error) bool
- func IsErrRepoNotExist(err error) bool
- func IsErrUserAlreadyExist(err error) bool
- func IsErrUserHasOrgs(err error) bool
- func IsErrUserNotExist(err error) bool
- func IsErrUserOwnRepos(err error) bool
- func IsErrWebhookNotExist(err error) bool
- func IsOrganizationMember(orgId, uid int64) bool
- func IsOrganizationOwner(orgId, uid int64) bool
- func IsPublicMembership(orgId, uid int64) bool
- func IsReleaseExist(repoId int64, tagName string) (bool, error)
- func IsRepositoryExist(u *User, repoName string) (bool, error)
- func IsStaring(uid, repoId int64) bool
- func IsTeamMember(orgID, teamID, uid int64) bool
- func IsUsableName(name string) error
- func IsUserExist(uid int64, name string) (bool, error)
- func IsValidHookContentType(name string) bool
- func IsValidHookTaskType(name string) bool
- func IsWatching(uid, repoId int64) bool
- func LoadConfigs()
- func LoadRepoConfig()
- func LoginAuth(username, password string) smtp.Auth
- func MakeEmailPrimary(email *EmailAddress) error
- func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error
- func MilestoneStats(repoID int64) (open int64, closed int64)
- func MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error
- func MirrorUpdate()
- func NewAccessToken(t *AccessToken) error
- func NewEngine() (err error)
- func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error)
- func NewIssueLabel(issue *Issue, label *Label) (err error)
- func NewIssueUsers(repo *Repository, issue *Issue) (err error)
- func NewLabel(l *Label) error
- func NewMilestone(m *Milestone) (err error)
- func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, ...) (err error)
- func NewRepoAction(u *User, repo *Repository) (err error)
- func NewRepoContext()
- func NewTeam(t *Team) (err error)
- func NewTestEngine(x *xorm.Engine) (err error)
- func NotifyWatchers(act *Action) error
- func PairsContains(ius []*IssueUser, issueId, uid int64) int
- func Ping() error
- func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error
- func RemoveOrgRepo(orgID, repoID int64) error
- func RemoveOrgUser(orgId, uid int64) error
- func RemoveTeamMember(orgId, teamId, uid int64) error
- func RemoveTeamRepo(teamID, repoID int64) error
- func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error
- func RepoPath(userName, repoName string) string
- func RewriteAllPublicKeys() error
- func RewriteRepositoryUpdateHook() error
- func SMTPAuth(a smtp.Auth, cfg *SMTPConfig) error
- func SetEngine() (err error)
- func SlackLinkFormatter(url string, text string) string
- func SlackTextFormatter(s string) string
- func SortReleases(rels []*Release)
- func StarRepo(uid, repoId int64, star bool) (err error)
- func TransferOwnership(u *User, newOwnerName string, repo *Repository) error
- func TransferRepoAction(actUser, oldOwner, newOwner *User, repo *Repository) error
- func UnFollowUser(userId int64, unFollowId int64) (err error)
- func Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, ...) error
- func UpdateAccessToekn(t *AccessToken) error
- func UpdateComment(c *Comment) error
- func UpdateDeployKey(key *DeployKey) error
- func UpdateHookTask(t *HookTask) error
- func UpdateIssue(issue *Issue) error
- func UpdateIssueUserByAssignee(issue *Issue) (err error)
- func UpdateIssueUserByRead(uid, issueID int64) error
- func UpdateIssueUsersByMentions(uids []int64, iid int64) error
- func UpdateIssueUsersByStatus(issueID int64, isClosed bool) error
- func UpdateLabel(l *Label) error
- func UpdateMentions(userNames []string, issueId int64) error
- func UpdateMilestone(m *Milestone) error
- func UpdateMirror(m *Mirror) error
- func UpdatePublicKey(key *PublicKey) error
- func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error)
- func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
- func UpdateSource(source *LoginSource) error
- func UpdateTeam(t *Team, authChanged bool) (err error)
- func UpdateUser(u *User) error
- func UpdateWebhook(w *Webhook) error
- func UserPath(userName string) string
- func ValidateCommitsWithEmails(oldCommits *list.List) *list.List
- func WatchRepo(uid, repoId int64, watch bool) (err error)
- type Access
- type AccessMode
- type AccessToken
- type Action
- func (a *Action) AfterSet(colName string, _ xorm.Cell)
- func (a Action) GetActEmail() string
- func (a Action) GetActUserName() string
- func (a Action) GetBranch() string
- func (a Action) GetContent() string
- func (a Action) GetCreate() time.Time
- func (a Action) GetIssueInfos() []string
- func (a Action) GetOpType() int
- func (a Action) GetRepoLink() string
- func (a Action) GetRepoName() string
- func (a Action) GetRepoPath() string
- func (a Action) GetRepoUserName() string
- type ActionType
- type Attachment
- type CloneLink
- type Collaboration
- type Comment
- func CreateComment(doer *User, repo *Repository, issue *Issue, commitID, line int64, ...) (comment *Comment, err error)
- func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, ...) (*Comment, error)
- func GetCommentByID(id int64) (*Comment, error)
- func GetCommentsByIssueID(issueID int64) ([]*Comment, error)
- type CommentTag
- type CommentType
- type CreateRepoOptions
- type DeployKey
- type Diff
- type DiffFile
- type DiffLine
- type DiffSection
- type EmailAddress
- type Engine
- type ErrAccessTokenNotExist
- type ErrAttachmentNotExist
- type ErrCommentNotExist
- type ErrDeployKeyAlreadyExist
- type ErrDeployKeyNameAlreadyUsed
- type ErrEmailAlreadyUsed
- type ErrIssueNotExist
- type ErrKeyAlreadyExist
- type ErrKeyNameAlreadyUsed
- type ErrKeyNotExist
- type ErrLabelNotExist
- type ErrLastOrgOwner
- type ErrMilestoneNotExist
- type ErrNamePatternNotAllowed
- type ErrNameReserved
- type ErrPullRequestNotExist
- type ErrRepoAlreadyExist
- type ErrRepoNotExist
- type ErrUserAlreadyExist
- type ErrUserHasOrgs
- type ErrUserNotExist
- type ErrUserOwnRepos
- type ErrWebhookNotExist
- type Follow
- type HookContentType
- type HookEvent
- type HookEventType
- type HookEvents
- type HookRequest
- type HookResponse
- type HookStatus
- type HookTask
- type HookTaskType
- type Issue
- func (i *Issue) AddLabel(label *Label) (err error)
- func (i *Issue) AfterSet(colName string, _ xorm.Cell)
- func (i *Issue) ChangeStatus(doer *User, isClosed bool) (err error)
- func (i *Issue) ClearLabels() (err error)
- func (i *Issue) GetAssignee() (err error)
- func (i *Issue) GetLabels() error
- func (i *Issue) GetPoster() (err error)
- func (i *Issue) HasLabel(labelID int64) bool
- func (i *Issue) HashTag() string
- func (i *Issue) IsPoster(uid int64) bool
- func (i *Issue) ReadBy(uid int64) error
- func (i *Issue) RemoveLabel(label *Label) (err error)
- type IssueLabel
- type IssueStats
- type IssueStatsOptions
- type IssueStatus
- type IssueUser
- type IssuesOptions
- type KeyType
- type LDAPConfig
- type Label
- type LoginSource
- func (source *LoginSource) BeforeSet(colName string, val xorm.Cell)
- func (source *LoginSource) IsDLDAP() bool
- func (source *LoginSource) IsLDAP() bool
- func (source *LoginSource) IsPAM() bool
- func (source *LoginSource) IsSMTP() bool
- func (source *LoginSource) LDAP() *LDAPConfig
- func (source *LoginSource) PAM() *PAMConfig
- func (source *LoginSource) SMTP() *SMTPConfig
- func (source *LoginSource) SkipVerify() bool
- func (source *LoginSource) TypeName() string
- func (source *LoginSource) UseTLS() bool
- type LoginType
- type Milestone
- type Mirror
- type Notice
- type NoticeType
- type OrgUser
- type PAMConfig
- type PublicKey
- type PullRequest
- type PullRequestType
- type Release
- type ReleaseSorter
- type Repository
- func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error)
- func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)
- func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error)
- func GetRepositories(uid int64, private bool) ([]*Repository, error)
- func GetRepositoriesByForkID(forkID int64) ([]*Repository, error)
- func GetRepositoryByID(id int64) (*Repository, error)
- func GetRepositoryByName(uid int64, repoName string) (*Repository, error)
- func GetRepositoryByRef(ref string) (*Repository, error)
- func HasForkedRepo(ownerID, repoID int64) (*Repository, bool)
- func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error)
- func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error)
- func SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error)
- func (repo *Repository) AddCollaborator(u *User) error
- func (repo *Repository) AfterSet(colName string, _ xorm.Cell)
- func (repo *Repository) CanBeForked() bool
- func (repo *Repository) CloneLink() (cl CloneLink, err error)
- func (repo *Repository) DeleteCollaborator(u *User) (err error)
- func (repo *Repository) DescriptionHtml() template.HTML
- func (repo *Repository) GetAssigneeByID(userID int64) (*User, error)
- func (repo *Repository) GetAssignees() (_ []*User, err error)
- func (repo *Repository) GetBaseRepo() (err error)
- func (repo *Repository) GetCollaborators() ([]*User, error)
- func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
- func (repo *Repository) GetMirror() (err error)
- func (repo *Repository) GetOwner() error
- func (repo *Repository) HasAccess(u *User) bool
- func (repo *Repository) IsOwnedBy(userID int64) bool
- func (repo *Repository) IssueStats(uid int64, filterMode int, isPull bool) (int64, int64)
- func (repo *Repository) NextIssueIndex() int64
- func (r *Repository) RecalculateAccesses() error
- func (repo *Repository) RepoLink() (string, error)
- func (repo *Repository) RepoPath() (string, error)
- type SMTPConfig
- type SearchOption
- type SlackAttachment
- type SlackMeta
- type SlackPayload
- type Star
- type Statistic
- type Team
- func (t *Team) AddMember(uid int64) error
- func (t *Team) AddRepository(repo *Repository) (err error)
- func (t *Team) GetMembers() (err error)
- func (t *Team) GetRepositories() error
- func (t *Team) HasRepository(repoID int64) bool
- func (t *Team) IsMember(uid int64) bool
- func (t *Team) IsOwnerTeam() bool
- func (t *Team) RemoveMember(uid int64) error
- func (t *Team) RemoveRepository(repoID int64) error
- type TeamRepo
- type TeamUser
- type UpdateTask
- type User
- func ExternalUserLogin(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error)
- func GetAssigneeByID(repo *Repository, userID int64) (*User, error)
- func GetOrgByName(name string) (*User, error)
- func GetOwnedOrgsByUserID(userID int64) ([]*User, error)
- func GetOwnedOrgsByUserIDDesc(userID int64, desc string) ([]*User, error)
- func GetTeamMembers(teamID int64) ([]*User, error)
- func GetUserByEmail(email string) (*User, error)
- func GetUserByID(id int64) (*User, error)
- func GetUserByKeyId(keyId int64) (*User, error)
- func GetUserByName(name string) (*User, error)
- func LoginUserLDAPSource(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error)
- func LoginUserPAMSource(u *User, name, passwd string, sourceId int64, cfg *PAMConfig, ...) (*User, error)
- func LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, ...) (*User, error)
- func NewFakeUser() *User
- func Organizations(page, pageSize int) ([]*User, error)
- func SearchUserByName(opt SearchOption) (us []*User, err error)
- func UserSignIn(uname, passwd string) (*User, error)
- func Users(page, pageSize int) ([]*User, error)
- func ValidateCommitWithEmail(c *git.Commit) *User
- func VerifyUserActiveCode(code string) (user *User)
- func (org *User) AddMember(uid int64) error
- func (u *User) AfterSet(colName string, _ xorm.Cell)
- func (u *User) AvatarLink() string
- func (u *User) CustomAvatarPath() string
- func (u *User) DashboardLink() string
- func (u *User) DisplayName() string
- func (u *User) EncodePasswd()
- func (u *User) GenerateActivateCode() string
- func (u *User) GenerateEmailActivateCode(email string) string
- func (u *User) GenerateRandomAvatar() error
- func (u *User) GetAccessibleRepositories() (map[*Repository]AccessMode, error)
- func (org *User) GetMembers() error
- func (u *User) GetOrganizationCount() (int64, error)
- func (u *User) GetOrganizations() error
- func (u *User) GetOwnedOrganizations() (err error)
- func (org *User) GetOwnerTeam() (*Team, error)
- func (u *User) GetRepositories() (err error)
- func (org *User) GetTeam(name string) (*Team, error)
- func (org *User) GetTeams() error
- func (u *User) HomeLink() string
- func (u *User) IsAdminOfRepo(repo *Repository) bool
- func (org *User) IsOrgMember(uid int64) bool
- func (u *User) IsOrganization() bool
- func (org *User) IsOwnedBy(uid int64) bool
- func (u *User) IsPublicMember(orgId int64) bool
- func (u *User) IsUserOrgOwner(orgId int64) bool
- func (u *User) NewGitSig() *git.Signature
- func (u *User) RelAvatarLink() string
- func (org *User) RemoveMember(uid int64) error
- func (org *User) RemoveOrgRepo(repoID int64) error
- func (u *User) UploadAvatar(data []byte) error
- func (u *User) ValidatePassword(passwd string) bool
- type UserCommit
- type UserType
- type Watch
- type Webhook
- func GetActiveWebhooksByOrgID(orgID int64) (ws []*Webhook, err error)
- func GetActiveWebhooksByRepoID(repoID int64) (ws []*Webhook, err error)
- func GetWebhookByID(id int64) (*Webhook, error)
- func GetWebhooksByOrgId(orgID int64) (ws []*Webhook, err error)
- func GetWebhooksByRepoId(repoID int64) (ws []*Webhook, err error)
- func (w *Webhook) AfterSet(colName string, _ xorm.Cell)
- func (w *Webhook) EventsArray() []string
- func (w *Webhook) GetSlackHook() *SlackMeta
- func (w *Webhook) HasCreateEvent() bool
- func (w *Webhook) HasPushEvent() bool
- func (w *Webhook) History(page int) ([]*HookTask, error)
- func (w *Webhook) UpdateEvent() error
Constants ¶
const ( DIFF_LINE_PLAIN = iota + 1 DIFF_LINE_ADD DIFF_LINE_DEL DIFF_LINE_SECTION )
Diff line types.
const ( DIFF_FILE_ADD = iota + 1 DIFF_FILE_CHANGE DIFF_FILE_DEL )
const ( IS_OPEN = iota + 1 IS_CLOSE )
const ( FM_ALL = iota FM_ASSIGN FM_CREATE FM_MENTION )
Filter modes.
const ( PULL_REQUEST_GOGS = iota PLLL_ERQUEST_GIT )
const ( SMTP_PLAIN = "PLAIN" SMTP_LOGIN = "LOGIN" )
const ( KEY_TYPE_USER = iota + 1 KEY_TYPE_DEPLOY )
const ( HOOK_STATUS_NONE = iota HOOK_STATUS_SUCCEED HOOK_STATUS_FAILED )
const DIFF_HEAD = "diff --git "
const OWNER_TEAM = "Owners"
Variables ¶
var ( // Same as Github. See https://help.github.com/articles/closing-issues-via-commit-messages IssueCloseKeywords = []string{"close", "closes", "closed", "fix", "fixes", "fixed", "resolve", "resolves", "resolved"} IssueReopenKeywords = []string{"reopen", "reopens", "reopened"} IssueCloseKeywordsPat, IssueReopenKeywordsPat *regexp.Regexp IssueReferenceKeywordsPat *regexp.Regexp )
var ( ErrWrongIssueCounter = errors.New("Invalid number of issues for this milestone") ErrAttachmentNotLinked = errors.New("Attachment does not belong to this issue") ErrMissingIssueNumber = errors.New("No issue number specified") )
var ( ErrAuthenticationAlreadyExist = errors.New("Authentication already exist") ErrAuthenticationNotExist = errors.New("Authentication does not exist") ErrAuthenticationUserUsed = errors.New("Authentication has been used by some users") )
var ( HasEngine bool DbCfg struct { Type, Host, Name, User, Passwd, Path, SSLMode string } EnableSQLite3 bool EnableTidb bool )
var ( ErrOrgNotExist = errors.New("Organization does not exist") ErrTeamAlreadyExist = errors.New("Team already exist") ErrTeamNotExist = errors.New("Team does not exist") ErrTeamNameIllegal = errors.New("Team name contains illegal characters") )
var ( ErrReleaseAlreadyExist = errors.New("Release already exist") ErrReleaseNotExist = errors.New("Release does not exist") )
var ( ErrRepoFileNotExist = errors.New("Repository file does not exist") ErrRepoFileNotLoaded = errors.New("Repository file not loaded") ErrMirrorNotExist = errors.New("Mirror does not exist") ErrInvalidReference = errors.New("Invalid reference specified") ErrNameEmpty = errors.New("Name is empty") )
var ( ErrUserNotKeyOwner = errors.New("User does not the owner of public key") ErrEmailNotExist = errors.New("E-mail does not exist") ErrEmailNotActivated = errors.New("E-mail address has not been activated") ErrUserNameIllegal = errors.New("User name contains illegal characters") ErrLoginSourceNotExist = errors.New("Login source does not exist") ErrLoginSourceNotActived = errors.New("Login source is not actived") ErrUnsupportedLoginType = errors.New("Login source is unknown") )
var (
DescPattern = regexp.MustCompile(`https?://\S+`)
)
var (
ErrKeyUnableVerify = errors.New("Unable to verify public key")
)
var (
ErrNotImplemented = errors.New("Not implemented yet")
)
var (
Gitignores, Licenses, Readmes []string
)
var HookQueue *hookQueue
var LoginNames = map[LoginType]string{ LDAP: "LDAP (via BindDN)", DLDAP: "LDAP (simple auth)", SMTP: "SMTP", PAM: "PAM", }
var SMTPAuths = []string{SMTP_PLAIN, SMTP_LOGIN}
var (
SSHPath string // SSH directory.
)
Functions ¶
func AddDeployKey ¶ added in v0.6.5
AddDeployKey add new deploy key to database and authorized_keys file.
func AddEmailAddress ¶ added in v0.5.11
func AddEmailAddress(email *EmailAddress) error
func AddOrgUser ¶ added in v0.5.0
AddOrgUser adds new user to given organization.
func AddPublicKey ¶
AddPublicKey adds new public key to database and authorized_keys file.
func AddTeamMember ¶ added in v0.5.0
AddTeamMember adds new member to given team of given organization.
func AddTeamRepo ¶ added in v0.6.0
AddTeamRepo adds new repository relation to team.
func AddUpdateTask ¶ added in v0.5.0
func AddUpdateTask(task *UpdateTask) error
func AttachmentLocalPath ¶ added in v0.6.5
AttachmentLocalPath returns where attachment is stored in local file system based on given UUID.
func ChangeMilestoneAssign ¶ added in v0.4.0
ChangeMilestoneAssign changes assignment of milestone for issue.
func ChangeMilestoneIssueStats ¶ added in v0.5.0
ChangeMilestoneIssueStats updates the open/closed issues counter and progress for the milestone associated witht the given issue.
func ChangeMilestoneStatus ¶ added in v0.4.0
ChangeMilestoneStatus changes the milestone open/closed status.
func ChangeOrgUserStatus ¶ added in v0.5.0
ChangeOrgUserStatus changes public or private membership status.
func ChangeRepositoryName ¶ added in v0.3.0
ChangeRepositoryName changes all corresponding setting from old repository name to new one.
func ChangeUserName ¶ added in v0.3.0
ChangeUserName changes all corresponding setting from old user name to new one.
func CheckPublicKeyString ¶ added in v0.5.0
CheckPublicKeyString checks if the given public key string is recognized by SSH.
func CheckRepoStats ¶ added in v0.6.3
func CheckRepoStats()
func CommitRepoAction ¶
func CommitRepoAction( userID, repoUserID int64, userName, actEmail string, repoID int64, repoUserName, repoName string, refFullName string, commit *base.PushCommits, oldCommitID string, newCommitID string) error
CommitRepoAction adds new action for committing repository.
func CountLoginSources ¶ added in v0.6.15
func CountLoginSources() int64
CountLoginSources returns number of login sources.
func CountNotices ¶ added in v0.5.5
func CountNotices() int64
CountNotices returns number of notices.
func CountOrganizations ¶ added in v0.5.0
func CountOrganizations() int64
CountOrganizations returns number of organizations.
func CountPublicRepositories ¶ added in v0.6.9
func CountPublicRepositories() int64
CountPublicRepositories returns number of public repositories.
func CountRepoClosedMilestones ¶ added in v0.6.5
CountRepoClosedMilestones returns number of closed milestones in given repository.
func CountRepoMilestones ¶ added in v0.6.5
CountRepoMilestones returns number of milestones in given repository.
func CountRepositories ¶ added in v0.5.0
func CountRepositories() int64
CountRepositories returns number of repositories.
func CreateHookTask ¶ added in v0.5.0
CreateHookTask creates a new hook task, it handles conversion from Payload to PayloadContent.
func CreateNotice ¶ added in v0.5.5
func CreateNotice(tp NoticeType, desc string) error
CreateNotice creates new system notice.
func CreateOrganization ¶ added in v0.5.0
CreateOrganization creates record of a new organization.
func CreateRefComment ¶ added in v0.6.15
func CreateRefComment(doer *User, repo *Repository, issue *Issue, content, commitSHA string) error
CreateRefComment creates a commit reference comment to issue.
func CreateRelease ¶ added in v0.3.0
func CreateRelease(gitRepo *git.Repository, rel *Release) error
CreateRelease creates a new release of repository.
func CreateRepositoryNotice ¶ added in v0.5.5
CreateRepositoryNotice creates new system notice with type NOTICE_REPOSITORY.
func CreateSource ¶ added in v0.5.0
func CreateSource(source *LoginSource) error
func CreateUser ¶ added in v0.5.0
CreateUser creates record of a new user.
func CreateWebhook ¶ added in v0.4.0
CreateWebhook creates a new web hook.
func DelUpdateTasksByUuid ¶ added in v0.5.0
func DeleteAccessTokenByID ¶ added in v0.6.9
DeleteAccessTokenByID deletes access token by given ID.
func DeleteAttachment ¶ added in v0.5.0
func DeleteAttachment(a *Attachment, remove bool) error
DeleteAttachment deletes the given attachment and optionally the associated file.
func DeleteAttachments ¶ added in v0.5.0
func DeleteAttachments(attachments []*Attachment, remove bool) (int, error)
DeleteAttachments deletes the given attachments and optionally the associated files.
func DeleteAttachmentsByComment ¶ added in v0.5.0
DeleteAttachmentsByComment deletes all attachments associated with the given comment.
func DeleteAttachmentsByIssue ¶ added in v0.5.0
DeleteAttachmentsByIssue deletes all attachments associated with the given issue.
func DeleteDeployKey ¶ added in v0.6.5
DeleteDeployKey deletes deploy key from its repository authorized_keys file if needed.
func DeleteEmailAddress ¶ added in v0.5.11
func DeleteEmailAddress(email *EmailAddress) error
func DeleteInactivateUsers ¶ added in v0.5.0
func DeleteInactivateUsers() (err error)
DeleteInactivateUsers deletes all inactivate users and email addresses.
func DeleteIssueLabel ¶ added in v0.6.5
DeleteIssueLabel deletes issue-label relation.
func DeleteLabel ¶ added in v0.4.0
DeleteLabel delete a label of given repository.
func DeleteMilestoneByID ¶ added in v0.6.5
DeleteMilestoneByID deletes a milestone by given ID.
func DeleteNotice ¶ added in v0.5.5
DeleteNotice deletes a system notice by given ID.
func DeleteOrganization ¶ added in v0.5.0
DeleteOrganization completely and permanently deletes everything of organization.
func DeletePublicKey ¶
DeletePublicKey deletes SSH key information both in database and authorized_keys file.
func DeleteRepository ¶
DeleteRepository deletes a repository for a user or organization.
func DeleteRepositoryArchives ¶ added in v0.5.8
func DeleteRepositoryArchives() error
DeleteRepositoryArchives deletes all repositories' archives.
func DeleteSource ¶ added in v0.6.15
func DeleteSource(source *LoginSource) error
func DeleteTeam ¶ added in v0.5.0
DeleteTeam deletes given team. It's caller's responsibility to assign organization ID.
func DeleteUser ¶
DeleteUser completely and permanently deletes everything of a user, but issues/comments/pulls will be kept and shown as someone has been deleted.
func DeleteWebhook ¶ added in v0.4.0
DeleteWebhook deletes webhook of repository.
func DeliverHooks ¶ added in v0.5.0
func DeliverHooks()
DeliverHooks checks and delivers undelivered hooks.
func DumpDatabase ¶ added in v0.4.0
DumpDatabase dumps all data from database to file system.
func FollowUser ¶
FollowUser marks someone be another's follower.
func GetIssueCountByPoster ¶ added in v0.4.0
GetIssueCountByPoster returns number of issues of repository by poster.
func GetRepoIssueStats ¶ added in v0.6.9
func GetRepoIssueStats(repoID, uid int64, filterMode int, isPull bool) (numOpen int64, numClosed int64)
GetRepoIssueStats returns number of open and closed repository issues by given filter mode.
func GetRepositoryCount ¶
GetRepositoryCount returns the total number of repositories of user.
func GetUserEmailsByNames ¶ added in v0.3.0
GetUserEmailsByNames returns a list of e-mails corresponds to names.
func GetUserIdsByNames ¶ added in v0.4.0
GetUserIdsByNames returns a slice of ids corresponds to names.
func GitGcRepos ¶ added in v0.5.9
func GitGcRepos() error
func HasAccess ¶
func HasAccess(u *User, repo *Repository, testMode AccessMode) (bool, error)
HasAccess returns true if someone has the request access level. User can be nil!
func HasDeployKey ¶ added in v0.6.5
HasDeployKey returns true if public key is a deploy key of given repository.
func HasIssueLabel ¶ added in v0.6.5
HasIssueLabel returns true if issue has been labeled.
func HasTeamRepo ¶ added in v0.6.0
HasTeamRepo returns true if given repository belongs to team.
func InitDeliverHooks ¶ added in v0.6.3
func InitDeliverHooks()
func IsEmailUsed ¶
IsEmailUsed returns true if the e-mail has been used.
func IsErrAccessTokenNotExist ¶ added in v0.6.9
func IsErrAttachmentNotExist ¶ added in v0.6.5
func IsErrCommentNotExist ¶ added in v0.6.9
func IsErrDeployKeyAlreadyExist ¶ added in v0.6.5
func IsErrDeployKeyNameAlreadyUsed ¶ added in v0.6.5
func IsErrEmailAlreadyUsed ¶ added in v0.6.3
func IsErrIssueNotExist ¶ added in v0.6.5
func IsErrKeyAlreadyExist ¶ added in v0.6.5
func IsErrKeyNameAlreadyUsed ¶ added in v0.6.5
func IsErrKeyNotExist ¶ added in v0.6.5
func IsErrLabelNotExist ¶ added in v0.6.5
func IsErrLastOrgOwner ¶ added in v0.6.0
func IsErrMilestoneNotExist ¶ added in v0.6.5
func IsErrNamePatternNotAllowed ¶ added in v0.6.3
func IsErrNameReserved ¶ added in v0.6.3
func IsErrPullRequestNotExist ¶ added in v0.6.9
func IsErrRepoAlreadyExist ¶ added in v0.6.5
func IsErrRepoNotExist ¶ added in v0.6.0
func IsErrUserAlreadyExist ¶ added in v0.6.3
func IsErrUserHasOrgs ¶ added in v0.6.0
func IsErrUserNotExist ¶ added in v0.6.5
func IsErrUserOwnRepos ¶ added in v0.6.0
func IsErrWebhookNotExist ¶ added in v0.6.9
func IsOrganizationMember ¶ added in v0.5.0
IsOrganizationMember returns true if given user is member of organization.
func IsOrganizationOwner ¶ added in v0.5.0
IsOrganizationOwner returns true if given user is in the owner team.
func IsPublicMembership ¶ added in v0.5.0
IsPublicMembership returns true if given user public his/her membership.
func IsReleaseExist ¶ added in v0.3.0
IsReleaseExist returns true if release with given tag name already exists.
func IsRepositoryExist ¶
IsRepositoryExist returns true if the repository with given name under user has already existed.
func IsTeamMember ¶ added in v0.5.0
IsTeamMember returns true if given user is a member of team.
func IsUsableName ¶ added in v0.6.3
IsUsableName checks if name is reserved or pattern of name is not allowed.
func IsUserExist ¶
IsUserExist checks if given user name exist, the user name should be noncased unique. If uid is presented, then check will rule out that one, it is used when update a user name in settings page.
func IsValidHookContentType ¶ added in v0.5.8
IsValidHookContentType returns true if given name is a valid hook content type.
func IsValidHookTaskType ¶ added in v0.5.8
IsValidHookTaskType returns true if given name is a valid hook task type.
func IsWatching ¶
IsWatching checks if user has watched given repository.
func LoadConfigs ¶ added in v0.6.15
func LoadConfigs()
func LoadRepoConfig ¶
func LoadRepoConfig()
func MakeEmailPrimary ¶ added in v0.5.11
func MakeEmailPrimary(email *EmailAddress) error
func MergePullRequestAction ¶ added in v0.6.9
func MergePullRequestAction(actUser *User, repo *Repository, pull *Issue) error
MergePullRequestAction adds new action for merging pull request.
func MilestoneStats ¶ added in v0.6.5
MilestoneStats returns number of open and closed milestones of given repository.
func MirrorRepository ¶ added in v0.3.0
MirrorRepository creates a mirror repository from source.
func MirrorUpdate ¶ added in v0.3.0
func MirrorUpdate()
MirrorUpdate checks and updates mirror repositories.
func NewAccessToken ¶ added in v0.5.8
func NewAccessToken(t *AccessToken) error
NewAccessToken creates new access token.
func NewIssue ¶ added in v0.4.0
func NewIssue(repo *Repository, issue *Issue, labelIDs []int64, uuids []string) (err error)
NewIssue creates new issue with labels for repository.
func NewIssueLabel ¶ added in v0.6.5
NewIssueLabel creates a new issue-label relation.
func NewIssueUsers ¶ added in v0.6.5
func NewIssueUsers(repo *Repository, issue *Issue) (err error)
NewIssueUsers adds new issue-user relations for new issue of repository.
func NewMilestone ¶ added in v0.4.0
NewMilestone creates new milestone of repository.
func NewPullRequest ¶ added in v0.6.9
func NewPullRequest(repo *Repository, pull *Issue, labelIDs []int64, uuids []string, pr *PullRequest, patch []byte) (err error)
NewPullRequest creates new pull request with labels for repository.
func NewRepoAction ¶
func NewRepoAction(u *User, repo *Repository) (err error)
NewRepoAction adds new action for creating repository.
func NewRepoContext ¶
func NewRepoContext()
func NewTeam ¶ added in v0.5.0
NewTeam creates a record of new team. It's caller's responsibility to assign organization ID.
func NewTestEngine ¶
func NotifyWatchers ¶
NotifyWatchers creates batch of actions for every watcher.
func PairsContains ¶ added in v0.4.0
PairsContains returns true when pairs list contains given issue.
func PrepareWebhooks ¶ added in v0.6.9
func PrepareWebhooks(repo *Repository, event HookEventType, p api.Payloader) error
PrepareWebhooks adds new webhooks to task queue for given payload.
func RemoveOrgRepo ¶ added in v0.6.0
RemoveOrgRepo removes all team-repository relations of given organization.
func RemoveOrgUser ¶ added in v0.5.0
RemoveOrgUser removes user from given organization.
func RemoveTeamMember ¶ added in v0.5.0
RemoveTeamMember removes member from given team of given organization.
func RemoveTeamRepo ¶ added in v0.6.0
RemoveTeamRepo deletes repository relation to team.
func RenameRepoAction ¶ added in v0.6.9
func RenameRepoAction(actUser *User, oldRepoName string, repo *Repository) error
RenameRepoAction adds new action for renaming a repository.
func RewriteAllPublicKeys ¶ added in v0.5.13
func RewriteAllPublicKeys() error
RewriteAllPublicKeys removes any authorized key and rewrite all keys from database again.
func RewriteRepositoryUpdateHook ¶ added in v0.5.13
func RewriteRepositoryUpdateHook() error
RewriteRepositoryUpdateHook rewrites all repositories' update hook.
func SlackLinkFormatter ¶ added in v0.5.0
func SlackTextFormatter ¶ added in v0.5.0
func SortReleases ¶ added in v0.5.0
func SortReleases(rels []*Release)
SortReleases sorts releases by number of commits and created time.
func TransferOwnership ¶ added in v0.3.0
func TransferOwnership(u *User, newOwnerName string, repo *Repository) error
TransferOwnership transfers all corresponding setting from old user to new one.
func TransferRepoAction ¶ added in v0.3.0
func TransferRepoAction(actUser, oldOwner, newOwner *User, repo *Repository) error
TransferRepoAction adds new action for transferring repository.
func UnFollowUser ¶
UnFollowUser unmarks someone be another's follower.
func UpdateAccessToekn ¶ added in v0.6.9
func UpdateAccessToekn(t *AccessToken) error
UpdateAccessToekn updates information of access token.
func UpdateComment ¶ added in v0.6.9
UpdateComment updates information of comment.
func UpdateDeployKey ¶ added in v0.6.5
UpdateDeployKey updates deploy key information.
func UpdateHookTask ¶ added in v0.5.0
UpdateHookTask updates information of hook task.
func UpdateIssueUserByAssignee ¶ added in v0.6.5
UpdateIssueUserByAssignee updates issue-user relation for assignee.
func UpdateIssueUserByRead ¶ added in v0.6.5
UpdateIssueUserByRead updates issue-user relation for reading.
func UpdateIssueUsersByMentions ¶ added in v0.6.5
UpdateIssueUsersByMentions updates issue-user pairs by mentioning.
func UpdateIssueUsersByStatus ¶ added in v0.6.5
UpdateIssueUsersByStatus updates issue-user relations by issue status.
func UpdateLabel ¶ added in v0.4.0
UpdateLabel updates label information.
func UpdateMentions ¶ added in v0.5.0
func UpdateMilestone ¶ added in v0.4.0
UpdateMilestone updates information of given milestone.
func UpdateMirror ¶ added in v0.3.0
func UpdatePublicKey ¶ added in v0.5.0
UpdatePublicKey updates given public key.
func UpdateRelease ¶ added in v0.5.0
func UpdateRelease(gitRepo *git.Repository, rel *Release) (err error)
UpdateRelease updates information of a release.
func UpdateRepository ¶
func UpdateRepository(repo *Repository, visibilityChanged bool) (err error)
func UpdateSource ¶ added in v0.4.0
func UpdateSource(source *LoginSource) error
func UpdateTeam ¶ added in v0.5.0
UpdateTeam updates information of team.
func UpdateWebhook ¶ added in v0.4.0
UpdateWebhook updates information of webhook.
func ValidateCommitsWithEmails ¶ added in v0.5.5
ValidateCommitsWithEmails checks if authors' e-mails of commits are corresponding to users.
Types ¶
type Access ¶
type Access struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(s)"` RepoID int64 `xorm:"UNIQUE(s)"` Mode AccessMode }
Access represents the highest access level of a user to the repository. The only access type that is not in this table is the real owner of a repository. In case of an organization repository, the members of the owners team are in this table.
type AccessMode ¶ added in v0.6.0
type AccessMode int
const ( ACCESS_MODE_NONE AccessMode = iota ACCESS_MODE_READ ACCESS_MODE_WRITE ACCESS_MODE_ADMIN ACCESS_MODE_OWNER )
func AccessLevel ¶ added in v0.6.0
func AccessLevel(u *User, repo *Repository) (AccessMode, error)
AccessLevel returns the Access a user has to a repository. Will return NoneAccess if the user does not have access. User can be nil!
type AccessToken ¶ added in v0.5.8
type AccessToken struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX"` Name string Sha1 string `xorm:"UNIQUE VARCHAR(40)"` Created time.Time `xorm:"CREATED"` Updated time.Time HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
AccessToken represents a personal access token.
func GetAccessTokenBySHA ¶ added in v0.6.9
func GetAccessTokenBySHA(sha string) (*AccessToken, error)
GetAccessTokenBySHA returns access token by given sha1.
func ListAccessTokens ¶ added in v0.5.8
func ListAccessTokens(uid int64) ([]*AccessToken, error)
ListAccessTokens returns a list of access tokens belongs to given user.
type Action ¶
type Action struct { ID int64 `xorm:"pk autoincr"` UserID int64 // Receiver user id. OpType ActionType ActUserID int64 // Action user id. ActUserName string // Action user name. ActEmail string ActAvatar string `xorm:"-"` RepoID int64 RepoUserName string RepoName string RefName string IsPrivate bool `xorm:"NOT NULL DEFAULT false"` Content string `xorm:"TEXT"` Created time.Time `xorm:"created"` }
Action represents user operation type and other information to repository., it implemented interface base.Actioner so that can be used in template render.
func (Action) GetActEmail ¶
func (Action) GetActUserName ¶
func (Action) GetContent ¶
func (Action) GetIssueInfos ¶ added in v0.5.0
func (Action) GetRepoLink ¶ added in v0.5.0
func (Action) GetRepoName ¶
func (Action) GetRepoPath ¶ added in v0.6.0
func (Action) GetRepoUserName ¶ added in v0.4.0
type ActionType ¶ added in v0.5.0
type ActionType int
const ( CREATE_REPO ActionType = iota + 1 // 1 RENAME_REPO // 2 STAR_REPO // 3 FOLLOW_REPO // 4 COMMIT_REPO // 5 CREATE_ISSUE // 6 CREATE_PULL_REQUEST // 7 TRANSFER_REPO // 8 PUSH_TAG // 9 COMMENT_ISSUE // 10 MERGE_PULL_REQUEST // 11 )
type Attachment ¶ added in v0.5.0
type Attachment struct { ID int64 `xorm:"pk autoincr"` UUID string `xorm:"uuid UNIQUE"` IssueID int64 `xorm:"INDEX"` CommentID int64 ReleaseID int64 `xorm:"INDEX"` Name string Created time.Time `xorm:"CREATED"` }
Attachment represent a attachment of issue/comment/release.
func GetAttachmentByUUID ¶ added in v0.6.5
func GetAttachmentByUUID(uuid string) (*Attachment, error)
GetAttachmentByUUID returns attachment by given UUID.
func GetAttachmentsByCommentID ¶ added in v0.6.5
func GetAttachmentsByCommentID(commentID int64) ([]*Attachment, error)
GetAttachmentsByCommentID returns all attachments if comment by given ID.
func GetAttachmentsByIssueID ¶ added in v0.6.5
func GetAttachmentsByIssueID(issueID int64) ([]*Attachment, error)
GetAttachmentsByIssueID returns all attachments for given issue by ID.
func NewAttachment ¶ added in v0.6.5
NewAttachment creates a new attachment object.
func (*Attachment) LocalPath ¶ added in v0.6.5
func (attach *Attachment) LocalPath() string
LocalPath returns where attachment is stored in local file system.
type Collaboration ¶ added in v0.6.0
type Collaboration struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` UserID int64 `xorm:"UNIQUE(s) INDEX NOT NULL"` Created time.Time `xorm:"CREATED"` }
A Collaboration is a relation between an individual and a repository
type Comment ¶
type Comment struct { ID int64 `xorm:"pk autoincr"` Type CommentType PosterID int64 Poster *User `xorm:"-"` IssueID int64 `xorm:"INDEX"` CommitID int64 Line int64 Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` Created time.Time `xorm:"CREATED"` // Reference issue in commit message CommitSHA string `xorm:"VARCHAR(40)"` Attachments []*Attachment `xorm:"-"` // For view issue page. ShowTag CommentTag `xorm:"-"` }
Comment represents a comment in commit and issue page.
func CreateComment ¶
func CreateComment(doer *User, repo *Repository, issue *Issue, commitID, line int64, cmtType CommentType, content, commitSHA string, attachments []string) (comment *Comment, err error)
CreateComment creates comment of issue or commit.
func CreateIssueComment ¶ added in v0.6.5
func CreateIssueComment(doer *User, repo *Repository, issue *Issue, content string, attachments []string) (*Comment, error)
CreateIssueComment creates a plain issue comment.
func GetCommentByID ¶ added in v0.6.9
GetCommentByID returns the comment by given ID.
func GetCommentsByIssueID ¶ added in v0.6.5
GetCommentsByIssueID returns all comments of issue by given ID.
func (*Comment) AfterDelete ¶ added in v0.5.0
func (c *Comment) AfterDelete()
type CommentTag ¶ added in v0.6.5
type CommentTag int
const ( COMMENT_TAG_NONE CommentTag = iota COMMENT_TAG_POSTER COMMENT_TAG_ADMIN COMMENT_TAG_OWNER )
type CommentType ¶ added in v0.5.0
type CommentType int
CommentType defines whether a comment is just a simple comment, an action (like close) or a reference.
const ( // Plain comment, can be associated with a commit (CommitId > 0) and a line (Line > 0) COMMENT_TYPE_COMMENT CommentType = iota COMMENT_TYPE_REOPEN COMMENT_TYPE_CLOSE // References. COMMENT_TYPE_ISSUE_REF // Reference from a commit (not part of a pull request) COMMENT_TYPE_COMMIT_REF // Reference from a comment COMMENT_TYPE_COMMENT_REF // Reference from a pull request COMMENT_TYPE_PULL_REF )
type CreateRepoOptions ¶ added in v0.6.9
type DeployKey ¶ added in v0.6.5
type DeployKey struct { ID int64 `xorm:"pk autoincr"` KeyID int64 `xorm:"UNIQUE(s) INDEX"` RepoID int64 `xorm:"UNIQUE(s) INDEX"` Name string Fingerprint string Created time.Time `xorm:"CREATED"` Updated time.Time // Note: Updated must below Created for AfterSet. HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
DeployKey represents deploy key information and its relation with repository.
func GetDeployKeyByRepo ¶ added in v0.6.5
GetDeployKeyByRepo returns deploy key by given public key ID and repository ID.
func ListDeployKeys ¶ added in v0.6.5
ListDeployKeys returns all deploy keys by given repository ID.
type Diff ¶
func GetDiffCommit ¶ added in v0.5.0
func GetDiffRange ¶ added in v0.5.0
func ParsePatch ¶
type DiffSection ¶
type EmailAddress ¶ added in v0.5.11
type EmailAddress struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX NOT NULL"` Email string `xorm:"UNIQUE NOT NULL"` IsActivated bool IsPrimary bool `xorm:"-"` }
EmailAdresses is the list of all email addresses of a user. Can contain the primary email address, but is not obligatory
func GetEmailAddresses ¶ added in v0.5.11
func GetEmailAddresses(uid int64) ([]*EmailAddress, error)
GetEmailAddresses returns all e-mail addresses belongs to given user.
func VerifyActiveEmailCode ¶ added in v0.5.11
func VerifyActiveEmailCode(code, email string) *EmailAddress
verify active code when active account
func (*EmailAddress) Activate ¶ added in v0.5.11
func (email *EmailAddress) Activate() error
type Engine ¶ added in v0.5.8
type Engine interface { Delete(interface{}) (int64, error) Exec(string, ...interface{}) (sql.Result, error) Find(interface{}, ...interface{}) error Get(interface{}) (bool, error) Insert(...interface{}) (int64, error) InsertOne(interface{}) (int64, error) Id(interface{}) *xorm.Session Sql(string, ...interface{}) *xorm.Session Where(string, ...interface{}) *xorm.Session }
Engine represents a xorm engine or session.
type ErrAccessTokenNotExist ¶ added in v0.5.8
type ErrAccessTokenNotExist struct {
SHA string
}
func (ErrAccessTokenNotExist) Error ¶ added in v0.6.9
func (err ErrAccessTokenNotExist) Error() string
type ErrAttachmentNotExist ¶ added in v0.5.0
func (ErrAttachmentNotExist) Error ¶ added in v0.6.5
func (err ErrAttachmentNotExist) Error() string
type ErrCommentNotExist ¶ added in v0.6.9
type ErrCommentNotExist struct {
ID int64
}
func (ErrCommentNotExist) Error ¶ added in v0.6.9
func (err ErrCommentNotExist) Error() string
type ErrDeployKeyAlreadyExist ¶ added in v0.6.5
func (ErrDeployKeyAlreadyExist) Error ¶ added in v0.6.5
func (err ErrDeployKeyAlreadyExist) Error() string
type ErrDeployKeyNameAlreadyUsed ¶ added in v0.6.5
func (ErrDeployKeyNameAlreadyUsed) Error ¶ added in v0.6.5
func (err ErrDeployKeyNameAlreadyUsed) Error() string
type ErrEmailAlreadyUsed ¶
type ErrEmailAlreadyUsed struct {
Email string
}
func (ErrEmailAlreadyUsed) Error ¶ added in v0.6.3
func (err ErrEmailAlreadyUsed) Error() string
type ErrIssueNotExist ¶
func (ErrIssueNotExist) Error ¶ added in v0.6.5
func (err ErrIssueNotExist) Error() string
type ErrKeyAlreadyExist ¶
func (ErrKeyAlreadyExist) Error ¶ added in v0.6.5
func (err ErrKeyAlreadyExist) Error() string
type ErrKeyNameAlreadyUsed ¶ added in v0.6.5
func (ErrKeyNameAlreadyUsed) Error ¶ added in v0.6.5
func (err ErrKeyNameAlreadyUsed) Error() string
type ErrKeyNotExist ¶
type ErrKeyNotExist struct {
ID int64
}
func (ErrKeyNotExist) Error ¶ added in v0.6.5
func (err ErrKeyNotExist) Error() string
type ErrLabelNotExist ¶ added in v0.4.0
type ErrLabelNotExist struct {
ID int64
}
func (ErrLabelNotExist) Error ¶ added in v0.6.5
func (err ErrLabelNotExist) Error() string
type ErrLastOrgOwner ¶ added in v0.5.0
type ErrLastOrgOwner struct {
UID int64
}
func (ErrLastOrgOwner) Error ¶ added in v0.6.0
func (err ErrLastOrgOwner) Error() string
type ErrMilestoneNotExist ¶ added in v0.4.0
func (ErrMilestoneNotExist) Error ¶ added in v0.6.5
func (err ErrMilestoneNotExist) Error() string
type ErrNamePatternNotAllowed ¶ added in v0.6.3
type ErrNamePatternNotAllowed struct {
Pattern string
}
func (ErrNamePatternNotAllowed) Error ¶ added in v0.6.3
func (err ErrNamePatternNotAllowed) Error() string
type ErrNameReserved ¶ added in v0.6.3
type ErrNameReserved struct {
Name string
}
func (ErrNameReserved) Error ¶ added in v0.6.3
func (err ErrNameReserved) Error() string
type ErrPullRequestNotExist ¶ added in v0.6.9
type ErrPullRequestNotExist struct { ID int64 PullID int64 HeadRepoID int64 BaseRepoID int64 HeadBarcnh string BaseBranch string }
func (ErrPullRequestNotExist) Error ¶ added in v0.6.9
func (err ErrPullRequestNotExist) Error() string
type ErrRepoAlreadyExist ¶
func (ErrRepoAlreadyExist) Error ¶ added in v0.6.5
func (err ErrRepoAlreadyExist) Error() string
type ErrRepoNotExist ¶
func (ErrRepoNotExist) Error ¶ added in v0.6.0
func (err ErrRepoNotExist) Error() string
type ErrUserAlreadyExist ¶
type ErrUserAlreadyExist struct {
Name string
}
func (ErrUserAlreadyExist) Error ¶ added in v0.6.3
func (err ErrUserAlreadyExist) Error() string
type ErrUserHasOrgs ¶ added in v0.5.0
type ErrUserHasOrgs struct {
UID int64
}
func (ErrUserHasOrgs) Error ¶ added in v0.6.0
func (err ErrUserHasOrgs) Error() string
type ErrUserNotExist ¶
func (ErrUserNotExist) Error ¶ added in v0.6.5
func (err ErrUserNotExist) Error() string
type ErrUserOwnRepos ¶
type ErrUserOwnRepos struct {
UID int64
}
func (ErrUserOwnRepos) Error ¶ added in v0.6.0
func (err ErrUserOwnRepos) Error() string
type ErrWebhookNotExist ¶ added in v0.4.0
type ErrWebhookNotExist struct {
ID int64
}
func (ErrWebhookNotExist) Error ¶ added in v0.6.9
func (err ErrWebhookNotExist) Error() string
type Follow ¶
type Follow struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(follow)"` FollowID int64 `xorm:"UNIQUE(follow)"` }
Follow is connection request for receiving user notification.
type HookContentType ¶ added in v0.5.0
type HookContentType int
const ( JSON HookContentType = iota + 1 FORM )
func ToHookContentType ¶ added in v0.5.8
func ToHookContentType(name string) HookContentType
ToHookContentType returns HookContentType by given name.
func (HookContentType) Name ¶ added in v0.5.8
func (t HookContentType) Name() string
type HookEvent ¶ added in v0.4.0
type HookEvent struct { PushOnly bool `json:"push_only"` SendEverything bool `json:"send_everything"` ChooseEvents bool `json:"choose_events"` HookEvents `json:"events"` }
HookEvent represents events that will delivery hook.
type HookEventType ¶ added in v0.5.0
type HookEventType string
const ( HOOK_EVENT_CREATE HookEventType = "create" HOOK_EVENT_PUSH HookEventType = "push" )
type HookEvents ¶ added in v0.6.9
type HookRequest ¶ added in v0.6.9
HookRequest represents hook task request information.
type HookResponse ¶ added in v0.6.9
type HookResponse struct { Status int `json:"status"` Headers map[string]string `json:"headers"` Body string `json:"body"` }
HookResponse represents hook task response information.
type HookStatus ¶ added in v0.6.9
type HookStatus int
type HookTask ¶ added in v0.5.0
type HookTask struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` HookID int64 UUID string Type HookTaskType URL string api.Payloader `xorm:"-"` PayloadContent string `xorm:"TEXT"` ContentType HookContentType EventType HookEventType IsSSL bool IsDelivered bool Delivered int64 DeliveredString string `xorm:"-"` // History info. IsSucceed bool RequestContent string `xorm:"TEXT"` RequestInfo *HookRequest `xorm:"-"` ResponseContent string `xorm:"TEXT"` ResponseInfo *HookResponse `xorm:"-"` }
HookTask represents a hook task.
func (*HookTask) BeforeUpdate ¶ added in v0.6.9
func (t *HookTask) BeforeUpdate()
func (*HookTask) MarshalJSON ¶ added in v0.6.9
type HookTaskType ¶ added in v0.5.0
type HookTaskType int
const ( GOGS HookTaskType = iota + 1 SLACK )
func ToHookTaskType ¶ added in v0.5.8
func ToHookTaskType(name string) HookTaskType
ToHookTaskType returns HookTaskType by given name.
func (HookTaskType) Name ¶ added in v0.5.8
func (t HookTaskType) Name() string
type Issue ¶
type Issue struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` Index int64 // Index in one repository. Name string Repo *Repository `xorm:"-"` PosterID int64 Poster *User `xorm:"-"` Labels []*Label `xorm:"-"` MilestoneID int64 Milestone *Milestone `xorm:"-"` AssigneeID int64 Assignee *User `xorm:"-"` IsRead bool `xorm:"-"` IsPull bool // Indicates whether is a pull request or not. *PullRequest `xorm:"-"` IsClosed bool Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` Priority int NumComments int Deadline time.Time Created time.Time `xorm:"CREATED"` Updated time.Time `xorm:"UPDATED"` Attachments []*Attachment `xorm:"-"` Comments []*Comment `xorm:"-"` }
Issue represents an issue or pull request of repository.
func GetIssueByID ¶ added in v0.6.5
GetIssueByID returns an issue by given ID.
func GetIssueByIndex ¶
GetIssueByIndex returns issue by given index in repository.
func GetIssueByRef ¶ added in v0.5.0
GetIssueByRef returns an Issue specified by a GFM reference. See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
func Issues ¶ added in v0.6.5
func Issues(opts *IssuesOptions) ([]*Issue, error)
Issues returns a list of issues by given conditions.
func (*Issue) ChangeStatus ¶ added in v0.6.5
ChangeStatus changes issue status to open/closed.
func (*Issue) ClearLabels ¶ added in v0.6.5
func (*Issue) GetAssignee ¶ added in v0.4.0
func (*Issue) GetLabels ¶ added in v0.4.0
GetLabels retrieves all labels of issue and assign to corresponding field.
func (*Issue) HasLabel ¶ added in v0.6.5
HasLabel returns true if issue has been labeled by given ID.
func (*Issue) RemoveLabel ¶ added in v0.6.5
RemoveLabel removes a label from issue by given ID.
type IssueLabel ¶ added in v0.6.5
type IssueLabel struct { ID int64 `xorm:"pk autoincr"` IssueID int64 `xorm:"UNIQUE(s)"` LabelID int64 `xorm:"UNIQUE(s)"` }
IssueLabel represetns an issue-lable relation.
func GetIssueLabels ¶ added in v0.6.5
func GetIssueLabels(issueID int64) ([]*IssueLabel, error)
GetIssueLabels returns all issue-label relations of given issue by ID.
type IssueStats ¶ added in v0.4.0
type IssueStats struct {
OpenCount, ClosedCount int64
AllCount int64
AssignCount int64
CreateCount int64
MentionCount int64
}
IssueStats represents issue statistic information.
func GetIssueStats ¶ added in v0.4.0
func GetIssueStats(opts *IssueStatsOptions) *IssueStats
GetIssueStats returns issue statistic information by given conditions.
func GetUserIssueStats ¶ added in v0.4.0
func GetUserIssueStats(repoID, uid int64, repoIDs []int64, filterMode int, isPull bool) *IssueStats
GetUserIssueStats returns issue statistic information for dashboard by given conditions.
type IssueStatsOptions ¶ added in v0.6.9
type IssueStatus ¶ added in v0.4.0
type IssueStatus int
type IssueUser ¶ added in v0.4.0
type IssueUser struct { ID int64 `xorm:"pk autoincr"` UID int64 `xorm:"INDEX"` // User ID. IssueID int64 RepoID int64 `xorm:"INDEX"` MilestoneID int64 IsRead bool IsAssigned bool IsMentioned bool IsPoster bool IsClosed bool }
IssueUser represents an issue-user relation.
func GetIssueUserPairsByMode ¶ added in v0.4.0
func GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int) ([]*IssueUser, error)
GetIssueUserPairsByMode returns issue-user pairs by given repository and user.
func GetIssueUserPairsByRepoIds ¶ added in v0.4.0
GetIssueUserPairsByRepoIds returns issue-user pairs by given repository IDs.
type IssuesOptions ¶ added in v0.6.9
type LDAPConfig ¶ added in v0.4.0
func (*LDAPConfig) FromDB ¶ added in v0.4.0
func (cfg *LDAPConfig) FromDB(bs []byte) error
func (*LDAPConfig) ToDB ¶ added in v0.4.0
func (cfg *LDAPConfig) ToDB() ([]byte, error)
type Label ¶
type Label struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` Name string Color string `xorm:"VARCHAR(7)"` NumIssues int NumClosedIssues int NumOpenIssues int `xorm:"-"` IsChecked bool `xorm:"-"` }
Label represents a label of repository for issues.
func GetLabelByID ¶ added in v0.6.5
GetLabelByID returns a label by given ID.
func GetLabelsByIssueID ¶ added in v0.6.5
GetLabelsByIssueID returns all labels that belong to given issue by ID.
func GetLabelsByRepoID ¶ added in v0.6.5
GetLabelsByRepoID returns all labels that belong to given repository by ID.
func (*Label) CalOpenIssues ¶ added in v0.4.0
func (m *Label) CalOpenIssues()
CalOpenIssues calculates the open issues of label.
type LoginSource ¶ added in v0.4.0
type LoginSource struct { ID int64 `xorm:"pk autoincr"` Type LoginType Name string `xorm:"UNIQUE"` IsActived bool `xorm:"NOT NULL DEFAULT false"` Cfg core.Conversion `xorm:"TEXT"` Created time.Time `xorm:"CREATED"` Updated time.Time `xorm:"UPDATED"` }
func GetLoginSourceByID ¶ added in v0.6.9
func GetLoginSourceByID(id int64) (*LoginSource, error)
func LoginSources ¶ added in v0.6.15
func LoginSources() ([]*LoginSource, error)
func (*LoginSource) BeforeSet ¶ added in v0.4.0
func (source *LoginSource) BeforeSet(colName string, val xorm.Cell)
func (*LoginSource) IsDLDAP ¶ added in v0.6.15
func (source *LoginSource) IsDLDAP() bool
func (*LoginSource) IsLDAP ¶ added in v0.6.15
func (source *LoginSource) IsLDAP() bool
func (*LoginSource) IsPAM ¶ added in v0.6.15
func (source *LoginSource) IsPAM() bool
func (*LoginSource) IsSMTP ¶ added in v0.6.15
func (source *LoginSource) IsSMTP() bool
func (*LoginSource) LDAP ¶ added in v0.4.0
func (source *LoginSource) LDAP() *LDAPConfig
func (*LoginSource) PAM ¶ added in v0.6.3
func (source *LoginSource) PAM() *PAMConfig
func (*LoginSource) SMTP ¶ added in v0.4.0
func (source *LoginSource) SMTP() *SMTPConfig
func (*LoginSource) SkipVerify ¶ added in v0.6.15
func (source *LoginSource) SkipVerify() bool
func (*LoginSource) TypeName ¶ added in v0.6.15
func (source *LoginSource) TypeName() string
func (*LoginSource) UseTLS ¶ added in v0.6.15
func (source *LoginSource) UseTLS() bool
type Milestone ¶
type Milestone struct { ID int64 `xorm:"pk autoincr"` RepoID int64 `xorm:"INDEX"` Name string Content string `xorm:"TEXT"` RenderedContent string `xorm:"-"` IsClosed bool NumIssues int NumClosedIssues int NumOpenIssues int `xorm:"-"` Completeness int // Percentage(1-100). Deadline time.Time DeadlineString string `xorm:"-"` IsOverDue bool `xorm:"-"` ClosedDate time.Time }
Milestone represents a milestone of repository.
func GetAllRepoMilestones ¶ added in v0.6.5
GetAllRepoMilestones returns all milestones of given repository.
func GetMilestoneByID ¶ added in v0.6.5
GetMilestoneByID returns the milestone of given ID.
func GetMilestones ¶ added in v0.4.0
GetMilestones returns a list of milestones of given repository and status.
func GetRepoMilestoneByID ¶ added in v0.6.5
GetRepoMilestoneByID returns the milestone of given ID and repository.
func (*Milestone) BeforeUpdate ¶ added in v0.6.5
func (m *Milestone) BeforeUpdate()
func (*Milestone) CalOpenIssues ¶ added in v0.4.0
func (m *Milestone) CalOpenIssues()
CalOpenIssues calculates the open issues of milestone.
type Mirror ¶ added in v0.3.0
type Mirror struct { ID int64 `xorm:"pk autoincr"` RepoID int64 Repo *Repository `xorm:"-"` Interval int // Hour. Updated time.Time `xorm:"UPDATED"` NextUpdate time.Time }
Mirror represents a mirror information of repository.
type Notice ¶ added in v0.5.5
type Notice struct { Id int64 Type NoticeType Description string `xorm:"TEXT"` Created time.Time `xorm:"CREATED"` }
Notice represents a system notice for admin.
type NoticeType ¶ added in v0.5.5
type NoticeType int
const (
NOTICE_REPOSITORY NoticeType = iota + 1
)
type OrgUser ¶ added in v0.5.0
type OrgUser struct { ID int64 `xorm:"pk autoincr"` Uid int64 `xorm:"INDEX UNIQUE(s)"` OrgID int64 `xorm:"INDEX UNIQUE(s)"` IsPublic bool IsOwner bool NumTeams int }
OrgUser represents an organization-user relation.
func GetOrgUsersByOrgId ¶ added in v0.5.0
GetOrgUsersByOrgId returns all organization-user relations by organization ID.
func GetOrgUsersByUserId ¶ added in v0.5.0
GetOrgUsersByUserId returns all organization-user relations by user ID.
type PAMConfig ¶ added in v0.6.3
type PAMConfig struct {
ServiceName string // pam service (e.g. system-auth)
}
type PublicKey ¶
type PublicKey struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"INDEX NOT NULL"` Name string `xorm:"NOT NULL"` Fingerprint string `xorm:"NOT NULL"` Content string `xorm:"TEXT NOT NULL"` Mode AccessMode `xorm:"NOT NULL DEFAULT 2"` Type KeyType `xorm:"NOT NULL DEFAULT 1"` Created time.Time `xorm:"CREATED"` Updated time.Time // Note: Updated must below Created for AfterSet. HasRecentActivity bool `xorm:"-"` HasUsed bool `xorm:"-"` }
PublicKey represents a SSH or deploy key.
func GetPublicKeyByID ¶ added in v0.6.5
GetPublicKeyByID returns public key by given ID.
func ListPublicKeys ¶ added in v0.5.8
ListPublicKeys returns a list of public keys belongs to given user.
func (*PublicKey) GetAuthorizedString ¶ added in v0.4.0
GetAuthorizedString generates and returns formatted public key string for authorized_keys file.
type PullRequest ¶ added in v0.6.9
type PullRequest struct { ID int64 `xorm:"pk autoincr"` PullID int64 `xorm:"INDEX"` Pull *Issue `xorm:"-"` PullIndex int64 HeadRepoID int64 HeadRepo *Repository `xorm:"-"` BaseRepoID int64 HeadUserName string HeadBarcnh string BaseBranch string MergeBase string `xorm:"VARCHAR(40)"` MergedCommitID string `xorm:"VARCHAR(40)"` Type PullRequestType CanAutoMerge bool HasMerged bool Merged time.Time MergerID int64 Merger *User `xorm:"-"` }
PullRequest represents relation between pull request and repositories.
func GetPullRequestByPullID ¶ added in v0.6.9
func GetPullRequestByPullID(pullID int64) (*PullRequest, error)
GetPullRequestByPullID returns pull repo by given pull ID.
func GetUnmergedPullRequest ¶ added in v0.6.9
func GetUnmergedPullRequest(headRepoID, baseRepoID int64, headBranch, baseBranch string) (*PullRequest, error)
GetUnmergedPullRequest returnss a pull request hasn't been merged by given info.
func (*PullRequest) AfterSet ¶ added in v0.6.9
func (pr *PullRequest) AfterSet(colName string, _ xorm.Cell)
func (*PullRequest) Merge ¶ added in v0.6.9
func (pr *PullRequest) Merge(doer *User, baseGitRepo *git.Repository) (err error)
Merge merges pull request to base repository.
type PullRequestType ¶ added in v0.6.9
type PullRequestType int
type Release ¶ added in v0.3.0
type Release struct { Id int64 RepoId int64 PublisherId int64 Publisher *User `xorm:"-"` TagName string LowerTagName string Target string Title string Sha1 string `xorm:"VARCHAR(40)"` NumCommits int NumCommitsBehind int `xorm:"-"` Note string `xorm:"TEXT"` IsDraft bool `xorm:"NOT NULL DEFAULT false"` IsPrerelease bool Created time.Time `xorm:"CREATED"` }
Release represents a release of repository.
func GetRelease ¶ added in v0.5.0
GetRelease returns release by given ID.
func GetReleasesByRepoId ¶ added in v0.3.0
GetReleasesByRepoId returns a list of releases of repository.
type ReleaseSorter ¶ added in v0.5.0
type ReleaseSorter struct {
// contains filtered or unexported fields
}
func (*ReleaseSorter) Len ¶ added in v0.5.0
func (rs *ReleaseSorter) Len() int
func (*ReleaseSorter) Less ¶ added in v0.5.0
func (rs *ReleaseSorter) Less(i, j int) bool
func (*ReleaseSorter) Swap ¶ added in v0.5.0
func (rs *ReleaseSorter) Swap(i, j int)
type Repository ¶
type Repository struct { ID int64 `xorm:"pk autoincr"` OwnerID int64 `xorm:"UNIQUE(s)"` Owner *User `xorm:"-"` LowerName string `xorm:"UNIQUE(s) INDEX NOT NULL"` Name string `xorm:"INDEX NOT NULL"` Description string Website string DefaultBranch 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:"-"` NumTags int `xorm:"-"` IsPrivate bool IsBare bool IsMirror bool *Mirror `xorm:"-"` IsFork bool `xorm:"NOT NULL DEFAULT false"` ForkID int64 BaseRepo *Repository `xorm:"-"` Created time.Time `xorm:"CREATED"` Updated time.Time `xorm:"UPDATED"` }
Repository represents a git repository.
func CreateRepository ¶
func CreateRepository(u *User, opts CreateRepoOptions) (_ *Repository, err error)
CreateRepository creates a repository for given user or organization.
func ForkRepository ¶
func ForkRepository(u *User, oldRepo *Repository, name, desc string) (_ *Repository, err error)
func GetRecentUpdatedRepositories ¶ added in v0.3.0
func GetRecentUpdatedRepositories(page int) (repos []*Repository, err error)
GetRecentUpdatedRepositories returns the list of repositories that are recently updated.
func GetRepositories ¶
func GetRepositories(uid int64, private bool) ([]*Repository, error)
GetRepositories returns a list of repositories of given user.
func GetRepositoriesByForkID ¶ added in v0.6.9
func GetRepositoriesByForkID(forkID int64) ([]*Repository, error)
GetRepositoriesByForkID returns all repositories with given fork ID.
func GetRepositoryByID ¶ added in v0.6.5
func GetRepositoryByID(id int64) (*Repository, error)
GetRepositoryByID returns the repository by given id if exists.
func GetRepositoryByName ¶
func GetRepositoryByName(uid int64, repoName string) (*Repository, error)
GetRepositoryByName returns the repository by given name under user if exists.
func GetRepositoryByRef ¶ added in v0.5.0
func GetRepositoryByRef(ref string) (*Repository, error)
GetRepositoryByRef returns a Repository specified by a GFM reference. See https://help.github.com/articles/writing-on-github#references for more information on the syntax.
func HasForkedRepo ¶ added in v0.6.5
func HasForkedRepo(ownerID, repoID int64) (*Repository, bool)
HasForkedRepo checks if given user has already forked a repository with given ID.
func MigrateRepository ¶ added in v0.3.0
func MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error)
MigrateRepository migrates a existing repository from other project hosting.
func RepositoriesWithUsers ¶ added in v0.6.15
func RepositoriesWithUsers(page, pageSize int) (_ []*Repository, err error)
RepositoriesWithUsers returns number of repos in given page.
func SearchRepositoryByName ¶ added in v0.5.0
func SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error)
SearchRepositoryByName returns given number of repositories whose name contains keyword.
func (*Repository) AddCollaborator ¶ added in v0.6.0
func (repo *Repository) AddCollaborator(u *User) error
Add collaborator and accompanying access
func (*Repository) AfterSet ¶ added in v0.6.9
func (repo *Repository) AfterSet(colName string, _ xorm.Cell)
func (*Repository) CanBeForked ¶ added in v0.6.15
func (repo *Repository) CanBeForked() bool
CanBeForked returns true if repository meets the requirements of being forked.
func (*Repository) CloneLink ¶ added in v0.5.9
func (repo *Repository) CloneLink() (cl CloneLink, err error)
CloneLink returns clone URLs of repository.
func (*Repository) DeleteCollaborator ¶ added in v0.6.0
func (repo *Repository) DeleteCollaborator(u *User) (err error)
Delete collaborator and accompanying access
func (*Repository) DescriptionHtml ¶ added in v0.5.0
func (repo *Repository) DescriptionHtml() template.HTML
DescriptionHtml does special handles to description and return HTML string.
func (*Repository) GetAssigneeByID ¶ added in v0.6.5
func (repo *Repository) GetAssigneeByID(userID int64) (*User, error)
GetAssigneeByID returns the user that has write access of repository by given ID.
func (*Repository) GetAssignees ¶ added in v0.6.5
func (repo *Repository) GetAssignees() (_ []*User, err error)
GetAssignees returns all users that have write access of repository.
func (*Repository) GetBaseRepo ¶ added in v0.6.5
func (repo *Repository) GetBaseRepo() (err error)
func (*Repository) GetCollaborators ¶ added in v0.6.0
func (repo *Repository) GetCollaborators() ([]*User, error)
GetCollaborators returns the collaborators for a repository
func (*Repository) GetMilestoneByID ¶ added in v0.6.5
func (repo *Repository) GetMilestoneByID(milestoneID int64) (*Milestone, error)
GetMilestoneByID returns the milestone belongs to repository by given ID.
func (*Repository) GetMirror ¶ added in v0.5.0
func (repo *Repository) GetMirror() (err error)
func (*Repository) GetOwner ¶ added in v0.4.0
func (repo *Repository) GetOwner() error
func (*Repository) HasAccess ¶ added in v0.5.5
func (repo *Repository) HasAccess(u *User) bool
func (*Repository) IsOwnedBy ¶ added in v0.5.8
func (repo *Repository) IsOwnedBy(userID int64) bool
func (*Repository) IssueStats ¶ added in v0.6.9
IssueStats returns number of open and closed repository issues by given filter mode.
func (*Repository) NextIssueIndex ¶ added in v0.6.9
func (repo *Repository) NextIssueIndex() int64
func (*Repository) RecalculateAccesses ¶ added in v0.6.0
func (r *Repository) RecalculateAccesses() error
RecalculateAccesses recalculates all accesses for repository.
func (*Repository) RepoLink ¶ added in v0.5.8
func (repo *Repository) RepoLink() (string, error)
func (*Repository) RepoPath ¶ added in v0.5.8
func (repo *Repository) RepoPath() (string, error)
type SMTPConfig ¶ added in v0.4.0
type SMTPConfig struct { Auth string Host string Port int AllowedDomains string `xorm:"TEXT"` TLS bool SkipVerify bool }
func (*SMTPConfig) FromDB ¶ added in v0.4.0
func (cfg *SMTPConfig) FromDB(bs []byte) error
func (*SMTPConfig) ToDB ¶ added in v0.4.0
func (cfg *SMTPConfig) ToDB() ([]byte, error)
type SearchOption ¶ added in v0.5.0
type SlackAttachment ¶ added in v0.5.0
type SlackPayload ¶ added in v0.5.0
type SlackPayload struct { Channel string `json:"channel"` Text string `json:"text"` Username string `json:"username"` IconURL string `json:"icon_url"` UnfurlLinks int `json:"unfurl_links"` LinkNames int `json:"link_names"` Attachments []SlackAttachment `json:"attachments"` }
func GetSlackPayload ¶ added in v0.5.0
func GetSlackPayload(p api.Payloader, event HookEventType, meta string) (*SlackPayload, error)
func (*SlackPayload) JSONPayload ¶ added in v0.6.9
func (p *SlackPayload) JSONPayload() ([]byte, error)
func (*SlackPayload) SetSecret ¶ added in v0.6.9
func (p *SlackPayload) SetSecret(_ string)
type Statistic ¶
type Statistic struct { Counter struct { User, Org, PublicKey, Repo, Watch, Star, Action, Access, Issue, Comment, Oauth, Follow, Mirror, Release, LoginSource, Webhook, Milestone, Label, HookTask, Team, UpdateTask, Attachment int64 } }
func GetStatistic ¶
func GetStatistic() (stats Statistic)
type Team ¶ added in v0.5.0
type Team struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` LowerName string Name string Description string Authorize AccessMode Repos []*Repository `xorm:"-"` Members []*User `xorm:"-"` NumRepos int NumMembers int }
Team represents a organization team.
func GetTeamById ¶ added in v0.5.0
GetTeamById returns team by given ID.
func GetUserTeams ¶ added in v0.5.0
GetUserTeams returns all teams that user belongs to in given organization.
func (*Team) AddRepository ¶ added in v0.5.0
func (t *Team) AddRepository(repo *Repository) (err error)
AddRepository adds new repository to team of organization.
func (*Team) GetMembers ¶ added in v0.5.0
GetMembers returns all members in team of organization.
func (*Team) GetRepositories ¶ added in v0.5.0
GetRepositories returns all repositories in team of organization.
func (*Team) HasRepository ¶ added in v0.6.0
HasRepository returns true if given repository belong to team.
func (*Team) IsMember ¶ added in v0.5.0
IsTeamMember returns true if given user is a member of team.
func (*Team) IsOwnerTeam ¶ added in v0.5.0
IsOwnerTeam returns true if team is owner team.
func (*Team) RemoveMember ¶ added in v0.5.0
RemoveMember removes member from team of organization.
func (*Team) RemoveRepository ¶ added in v0.5.0
RemoveRepository removes repository from team of organization.
type TeamRepo ¶ added in v0.6.0
type TeamRepo struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` TeamID int64 `xorm:"UNIQUE(s)"` RepoID int64 `xorm:"UNIQUE(s)"` }
TeamRepo represents an team-repository relation.
type TeamUser ¶ added in v0.5.0
type TeamUser struct { ID int64 `xorm:"pk autoincr"` OrgID int64 `xorm:"INDEX"` TeamID int64 `xorm:"UNIQUE(s)"` Uid int64 `xorm:"UNIQUE(s)"` }
TeamUser represents an team-user relation.
type UpdateTask ¶ added in v0.5.0
type UpdateTask struct { Id int64 Uuid string `xorm:"index"` RefName string OldCommitId string NewCommitId string }
func GetUpdateTasksByUuid ¶ added in v0.5.0
func GetUpdateTasksByUuid(uuid string) ([]*UpdateTask, error)
type User ¶
type User struct { Id int64 LowerName string `xorm:"UNIQUE NOT NULL"` Name string `xorm:"UNIQUE NOT NULL"` FullName string // Email is the primary email address (to be used for communication). Email string `xorm:"NOT NULL"` Passwd string `xorm:"NOT NULL"` LoginType LoginType LoginSource int64 `xorm:"NOT NULL DEFAULT 0"` LoginName string Type UserType OwnedOrgs []*User `xorm:"-"` Orgs []*User `xorm:"-"` Repos []*Repository `xorm:"-"` Location string Website string Rands string `xorm:"VARCHAR(10)"` Salt string `xorm:"VARCHAR(10)"` Created time.Time `xorm:"CREATED"` Updated time.Time `xorm:"UPDATED"` // Remember visibility choice for convenience. LastRepoVisibility bool // Permissions. IsActive bool IsAdmin bool AllowGitHook bool // Avatar. Avatar string `xorm:"VARCHAR(2048) NOT NULL"` AvatarEmail string `xorm:"NOT NULL"` UseCustomAvatar bool // Counters. NumFollowers int NumFollowings int NumStars int NumRepos int // For organization. Description string NumTeams int NumMembers int Teams []*Team `xorm:"-"` Members []*User `xorm:"-"` }
User represents the object of individual and member of organization.
func ExternalUserLogin ¶ added in v0.6.15
func GetAssigneeByID ¶ added in v0.6.5
func GetAssigneeByID(repo *Repository, userID int64) (*User, error)
GetAssigneeByID returns the user with write access of repository by given ID.
func GetOrgByName ¶ added in v0.5.9
GetOrgByName returns organization by given name.
func GetOwnedOrgsByUserID ¶ added in v0.6.15
GetOwnedOrgsByUserID returns a list of organizations are owned by given user ID.
func GetOwnedOrgsByUserIDDesc ¶ added in v0.6.15
GetOwnedOrganizationsByUserIDDesc returns a list of organizations are owned by given user ID and descring order by given condition.
func GetTeamMembers ¶ added in v0.5.0
GetTeamMembers returns all members in given team of organization.
func GetUserByEmail ¶ added in v0.3.0
GetUserByEmail returns the user object by given e-mail if exists.
func GetUserByID ¶ added in v0.6.5
GetUserByID returns the user object by given ID if exists.
func GetUserByKeyId ¶
func GetUserByName ¶
GetUserByName returns user by given name.
func LoginUserLDAPSource ¶ added in v0.6.15
func LoginUserLDAPSource(u *User, name, passwd string, source *LoginSource, autoRegister bool) (*User, error)
Query if name/passwd can login against the LDAP directory pool Create a local user if success Return the same LoginUserPlain semantic FIXME: https://github.com/gogits/gogs/issues/672
func LoginUserPAMSource ¶ added in v0.6.3
func LoginUserPAMSource(u *User, name, passwd string, sourceId int64, cfg *PAMConfig, autoRegister bool) (*User, error)
Query if name/passwd can login against PAM Create a local user if success Return the same LoginUserPlain semantic
func LoginUserSMTPSource ¶ added in v0.4.0
func LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error)
Query if name/passwd can login against the LDAP directory pool Create a local user if success Return the same LoginUserPlain semantic
func NewFakeUser ¶ added in v0.6.5
func NewFakeUser() *User
NewFakeUser creates and returns a fake user for someone has deleted his/her account.
func Organizations ¶ added in v0.6.15
Organizations returns number of organizations in given page.
func SearchUserByName ¶ added in v0.4.0
func SearchUserByName(opt SearchOption) (us []*User, err error)
SearchUserByName returns given number of users whose name contains keyword.
func UserSignIn ¶ added in v0.4.2
UserSignIn validates user name and password.
func ValidateCommitWithEmail ¶ added in v0.5.5
ValidateCommitWithEmail chceck if author's e-mail of commit is corresponsind to a user.
func VerifyUserActiveCode ¶
verify active code when active account
func (*User) CustomAvatarPath ¶ added in v0.5.9
CustomAvatarPath returns user custom avatar file path.
func (*User) DashboardLink ¶ added in v0.5.0
DashboardLink returns the user dashboard page link.
func (*User) DisplayName ¶ added in v0.6.9
DisplayName returns full name if it's not empty, returns username otherwise.
func (*User) EncodePasswd ¶
func (u *User) EncodePasswd()
EncodePasswd encodes password to safe format.
func (*User) GenerateActivateCode ¶ added in v0.6.15
GenerateActivateCode generates an activate code based on user information.
func (*User) GenerateEmailActivateCode ¶ added in v0.6.15
GenerateEmailActivateCode generates an activate code based on user information and given e-mail.
func (*User) GenerateRandomAvatar ¶ added in v0.6.15
GenerateRandomAvatar generates a random avatar for user.
func (*User) GetAccessibleRepositories ¶ added in v0.6.0
func (u *User) GetAccessibleRepositories() (map[*Repository]AccessMode, error)
GetAccessibleRepositories finds all repositories where a user has access to, besides he/she owns.
func (*User) GetMembers ¶ added in v0.5.0
GetMembers returns all members of organization.
func (*User) GetOrganizationCount ¶ added in v0.5.0
GetOrganizationCount returns count of membership of organization of user.
func (*User) GetOrganizations ¶ added in v0.5.0
GetOrganizations returns all organizations that user belongs to.
func (*User) GetOwnedOrganizations ¶ added in v0.6.15
GetOwnedOrganizations returns all organizations that user owns.
func (*User) GetOwnerTeam ¶ added in v0.5.0
GetOwnerTeam returns owner team of organization.
func (*User) GetRepositories ¶ added in v0.5.0
GetRepositories returns all repositories that user owns, including private repositories.
func (*User) IsAdminOfRepo ¶ added in v0.6.5
func (u *User) IsAdminOfRepo(repo *Repository) bool
IsAdminOfRepo returns true if user has admin or higher access of repository.
func (*User) IsOrgMember ¶ added in v0.5.0
IsOrgMember returns true if given user is member of organization.
func (*User) IsOrganization ¶ added in v0.5.0
IsOrganization returns true if user is actually a organization.
func (*User) IsPublicMember ¶ added in v0.5.0
IsPublicMember returns true if user public his/her membership in give organization.
func (*User) IsUserOrgOwner ¶ added in v0.5.0
IsUserOrgOwner returns true if user is in the owner team of given organization.
func (*User) RelAvatarLink ¶ added in v0.6.9
func (*User) RemoveMember ¶ added in v0.5.0
RemoveMember removes member from organization.
func (*User) RemoveOrgRepo ¶ added in v0.6.0
RemoveOrgRepo removes all team-repository relations of organization.
func (*User) UploadAvatar ¶ added in v0.5.9
UploadAvatar saves custom avatar for user. FIXME: split uploads to different subdirs in case we have massive users.
func (*User) ValidatePassword ¶ added in v0.6.3
ValidatePassword checks if given password matches the one belongs to the user.
type UserCommit ¶ added in v0.5.5
UserCommit represents a commit with validation of user.
type Watch ¶
type Watch struct { ID int64 `xorm:"pk autoincr"` UserID int64 `xorm:"UNIQUE(watch)"` RepoID int64 `xorm:"UNIQUE(watch)"` }
Watch is connection request for receiving repository notification.
func GetWatchers ¶ added in v0.4.0
GetWatchers returns all watchers of given repository.
type Webhook ¶ added in v0.4.0
type Webhook struct { ID int64 `xorm:"pk autoincr"` RepoID int64 OrgID int64 URL string `xorm:"url TEXT"` ContentType HookContentType Secret string `xorm:"TEXT"` Events string `xorm:"TEXT"` *HookEvent `xorm:"-"` IsSSL bool `xorm:"is_ssl"` IsActive bool HookTaskType HookTaskType Meta string `xorm:"TEXT"` // store hook-specific attributes LastStatus HookStatus // Last delivery status Created time.Time `xorm:"CREATED"` Updated time.Time `xorm:"UPDATED"` }
Webhook represents a web hook object.
func GetActiveWebhooksByOrgID ¶ added in v0.6.9
GetActiveWebhooksByOrgID returns all active webhooks for an organization.
func GetActiveWebhooksByRepoID ¶ added in v0.6.9
GetActiveWebhooksByRepoID returns all active webhooks of repository.
func GetWebhookByID ¶ added in v0.6.9
GetWebhookByID returns webhook by given ID.
func GetWebhooksByOrgId ¶ added in v0.5.0
GetWebhooksByOrgId returns all webhooks for an organization.
func GetWebhooksByRepoId ¶ added in v0.4.0
GetWebhooksByRepoId returns all webhooks of repository.
func (*Webhook) EventsArray ¶ added in v0.6.9
func (*Webhook) GetSlackHook ¶ added in v0.5.0
func (*Webhook) HasCreateEvent ¶ added in v0.6.9
HasCreateEvent returns true if hook enabled create event.
func (*Webhook) HasPushEvent ¶ added in v0.4.0
HasPushEvent returns true if hook enabled push event.
func (*Webhook) UpdateEvent ¶ added in v0.5.0
UpdateEvent handles conversion from HookEvent to Events.