{"modulePath":"github.com/developerspl/gogs","version":"v0.5.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package models\n\n## Constants\n\n```go\nconst (\n\tDIFF_LINE_PLAIN = iota + 1\n\tDIFF_LINE_ADD\n\tDIFF_LINE_DEL\n\tDIFF_LINE_SECTION\n)\n```\nDiff line types.\n\n```go\nconst (\n\tDIFF_FILE_ADD = iota + 1\n\tDIFF_FILE_CHANGE\n\tDIFF_FILE_DEL\n)\n```\n\n```go\nconst (\n\tIS_OPEN = iota + 1\n\tIS_CLOSE\n)\n```\n\n```go\nconst (\n\tFM_ASSIGN = iota + 1\n\tFM_CREATE\n\tFM_MENTION\n)\n```\nFilter modes.\n\n```go\nconst DIFF_HEAD = \"diff --git \"\n```\n\n```go\nconst OWNER_TEAM = \"Owners\"\n```\n\n```go\nconst (\n\tSLACK_COLOR string = \"#dd4b39\"\n)\n```\n\n```go\nconst (\n\tTPL_UPDATE_HOOK = \"#!/usr/bin/env %s\\n%s update $1 $2 $3\\n\"\n)\n```\n\n## Variables\n\n```go\nvar (\n\t// Same as Github. See https://help.github.com/articles/closing-issues-via-commit-messages\n\tIssueKeywords    = []string{\"close\", \"closes\", \"closed\", \"fix\", \"fixes\", \"fixed\", \"resolve\", \"resolves\", \"resolved\"}\n\tIssueKeywordsPat *regexp.Regexp\n)\n```\n\n```go\nvar (\n\tErrIssueNotExist       = errors.New(\"Issue does not exist\")\n\tErrLabelNotExist       = errors.New(\"Label does not exist\")\n\tErrMilestoneNotExist   = errors.New(\"Milestone does not exist\")\n\tErrWrongIssueCounter   = errors.New(\"Invalid number of issues for this milestone\")\n\tErrAttachmentNotExist  = errors.New(\"Attachment does not exist\")\n\tErrAttachmentNotLinked = errors.New(\"Attachment does not belong to this issue\")\n\tErrMissingIssueNumber  = errors.New(\"No issue number specified\")\n)\n```\n\n```go\nvar (\n\tErrAuthenticationAlreadyExist = errors.New(\"Authentication already exist\")\n\tErrAuthenticationNotExist     = errors.New(\"Authentication does not exist\")\n\tErrAuthenticationUserUsed     = errors.New(\"Authentication has been used by some users\")\n)\n```\n\n```go\nvar (\n\tSMTP_PLAIN = \"PLAIN\"\n\tSMTP_LOGIN = \"LOGIN\"\n\tSMTPAuths  = []string{SMTP_PLAIN, SMTP_LOGIN}\n)\n```\n\n```go\nvar (\n\tHasEngine bool\n\n\tDbCfg struct {\n\t\tType, Host, Name, User, Pwd, Path, SslMode string\n\t}\n\n\tEnableSQLite3 bool\n\tUseSQLite3    bool\n)\n```\n\n```go\nvar (\n\tErrOauth2RecordNotExist = errors.New(\"OAuth2 record does not exist\")\n\tErrOauth2NotAssociated  = errors.New(\"OAuth2 is not associated with user\")\n)\n```\n\n```go\nvar (\n\tErrOrgNotExist      = errors.New(\"Organization does not exist\")\n\tErrTeamAlreadyExist = errors.New(\"Team already exist\")\n\tErrTeamNotExist     = errors.New(\"Team does not exist\")\n\tErrTeamNameIllegal  = errors.New(\"Team name contains illegal characters\")\n\tErrLastOrgOwner     = errors.New(\"The user to remove is the last member in owner team\")\n)\n```\n\n```go\nvar (\n\tErrKeyAlreadyExist = errors.New(\"Public key already exist\")\n\tErrKeyNotExist     = errors.New(\"Public key does not exist\")\n)\n```\n\n```go\nvar (\n\tErrReleaseAlreadyExist = errors.New(\"Release already exist\")\n\tErrReleaseNotExist     = errors.New(\"Release does not exist\")\n)\n```\n\n```go\nvar (\n\tErrRepoAlreadyExist  = errors.New(\"Repository already exist\")\n\tErrRepoNotExist      = errors.New(\"Repository does not exist\")\n\tErrRepoFileNotExist  = errors.New(\"Repository file does not exist\")\n\tErrRepoNameIllegal   = errors.New(\"Repository name contains illegal characters\")\n\tErrRepoFileNotLoaded = errors.New(\"Repository file not loaded\")\n\tErrMirrorNotExist    = errors.New(\"Mirror does not exist\")\n\tErrInvalidReference  = errors.New(\"Invalid reference specified\")\n)\n```\n\n```go\nvar (\n\tErrUserOwnRepos          = errors.New(\"User still have ownership of repositories\")\n\tErrUserHasOrgs           = errors.New(\"User still have membership of organization\")\n\tErrUserAlreadyExist      = errors.New(\"User already exist\")\n\tErrUserNotExist          = errors.New(\"User does not exist\")\n\tErrUserNotKeyOwner       = errors.New(\"User does not the owner of public key\")\n\tErrEmailAlreadyUsed      = errors.New(\"E-mail already used\")\n\tErrUserNameIllegal       = errors.New(\"User name contains illegal characters\")\n\tErrLoginSourceNotExist   = errors.New(\"Login source does not exist\")\n\tErrLoginSourceNotActived = errors.New(\"Login source is not actived\")\n\tErrUnsupportedLoginType  = errors.New(\"Login source is unknown\")\n)\n```\n\n```go\nvar (\n\tDescriptionPattern = regexp.MustCompile(`https?://\\S+`)\n)\n```\n\n```go\nvar (\n\tErrNotImplemented = errors.New(\"Not implemented yet\")\n)\n```\n\n```go\nvar (\n\tErrWebhookNotExist = errors.New(\"Webhook does not exist\")\n)\n```\n\n```go\nvar (\n\tGitignores, Licenses []string\n)\n```\n\n```go\nvar LoginTypes = map[LoginType]string{\n\tLDAP: \"LDAP\",\n\tSMTP: \"SMTP\",\n}\n```\n\n```go\nvar (\n\tMinimumKeySize = map[string]int{\n\t\t\"(ED25519)\": 256,\n\t\t\"(ECDSA)\":   256,\n\t\t\"(NTRU)\":    1087,\n\t\t\"(MCE)\":     1702,\n\t\t\"(McE)\":     1702,\n\t\t\"(RSA)\":     2048,\n\t}\n)\n```\n\n```go\nvar (\n\tSshPath string // SSH directory.\n\n)\n```\n\n## Functions\n\n```go\nfunc AddAccess(access *Access) error\n```\nAddAccess adds new access record.\n\n```go\nfunc AddOauth2(oa *Oauth2) error\n```\n\n```go\nfunc AddOrgUser(orgId, uid int64) error\n```\nAddOrgUser adds new user to given organization.\n\n```go\nfunc AddPublicKey(key *PublicKey) (err error)\n```\nAddPublicKey adds new public key to database and authorized\\_keys file.\n\n```go\nfunc AddTeamMember(orgId, teamId, uid int64) error\n```\nAddTeamMember adds new member to given team of given organization.\n\n```go\nfunc AddUpdateTask(task *UpdateTask) error\n```\n\n```go\nfunc BindUserOauth2(userId, oauthId int64) error\n```\n\n```go\nfunc ChangeMilestoneAssign(oldMid, mid int64, issue *Issue) (err error)\n```\nChangeMilestoneAssign changes assignment of milestone for issue.\n\n```go\nfunc ChangeMilestoneIssueStats(issue *Issue) error\n```\nChangeMilestoneIssueStats updates the open/closed issues counter and progress for the milestone associated witht the given issue.\n\n```go\nfunc ChangeMilestoneStatus(m *Milestone, isClosed bool) (err error)\n```\nChangeMilestoneStatus changes the milestone open/closed status.\n\n```go\nfunc ChangeOrgUserStatus(orgId, uid int64, public bool) error\n```\nChangeOrgUserStatus changes public or private membership status.\n\n```go\nfunc ChangeRepositoryName(userName, oldRepoName, newRepoName string) (err error)\n```\nChangeRepositoryName changes all corresponding setting from old repository name to new one.\n\n```go\nfunc ChangeUserName(u *User, newUserName string) (err error)\n```\nChangeUserName changes all corresponding setting from old user name to new one.\n\n```go\nfunc CheckPublicKeyString(content string) (bool, error)\n```\nCheckPublicKeyString checks if the given public key string is recognized by SSH.\n\n```go\nfunc CleanUnbindOauth() error\n```\nCleanUnbindOauth deletes all unbind OAuthes.\n\n```go\nfunc CommitRepoAction(userId, repoUserId int64, userName, actEmail string,\n\trepoId int64, repoUserName, repoName string, refFullName string, commit *base.PushCommits, oldCommitId string, newCommitId string) error\n```\nCommitRepoAction adds new action for committing repository.\n\n```go\nfunc CountOrganizations() int64\n```\nCountOrganizations returns number of organizations.\n\n```go\nfunc CountRepositories() int64\n```\nCountRepositories returns number of repositories.\n\n```go\nfunc CountUsers() int64\n```\nCountUsers returns number of users.\n\n```go\nfunc CreateHookTask(t *HookTask) error\n```\nCreateHookTask creates a new hook task, it handles conversion from Payload to PayloadContent.\n\n```go\nfunc CreateRelease(gitRepo *git.Repository, rel *Release) error\n```\nCreateRelease creates a new release of repository.\n\n```go\nfunc CreateSource(source *LoginSource) error\n```\n\n```go\nfunc CreateUser(u *User) error\n```\nCreateUser creates record of a new user.\n\n```go\nfunc CreateWebhook(w *Webhook) error\n```\nCreateWebhook creates a new web hook.\n\n```go\nfunc DelLoginSource(source *LoginSource) error\n```\n\n```go\nfunc DelUpdateTasksByUuid(uuid string) error\n```\n\n```go\nfunc DeleteAccess(access *Access) error\n```\nDeleteAccess deletes access record.\n\n```go\nfunc DeleteAttachment(a *Attachment, remove bool) error\n```\nDeleteAttachment deletes the given attachment and optionally the associated file.\n\n```go\nfunc DeleteAttachments(attachments []*Attachment, remove bool) (int, error)\n```\nDeleteAttachments deletes the given attachments and optionally the associated files.\n\n```go\nfunc DeleteAttachmentsByComment(commentId int64, remove bool) (int, error)\n```\nDeleteAttachmentsByComment deletes all attachments associated with the given comment.\n\n```go\nfunc DeleteAttachmentsByIssue(issueId int64, remove bool) (int, error)\n```\nDeleteAttachmentsByIssue deletes all attachments associated with the given issue.\n\n```go\nfunc DeleteInactivateUsers() error\n```\nDeleteInactivateUsers deletes all inactivate users.\n\n```go\nfunc DeleteLabel(repoId int64, strId string) error\n```\nDeleteLabel delete a label of given repository.\n\n```go\nfunc DeleteMilestone(m *Milestone) (err error)\n```\nDeleteMilestone deletes a milestone.\n\n```go\nfunc DeleteOauth2ById(id int64) error\n```\nDeleteOauth2ById deletes a oauth2 by ID.\n\n```go\nfunc DeleteOrganization(org *User) (err error)\n```\nTODO: need some kind of mechanism to record failure. DeleteOrganization completely and permanently deletes everything of organization.\n\n```go\nfunc DeletePublicKey(key *PublicKey) error\n```\nDeletePublicKey deletes SSH key information both in database and authorized\\_keys file.\n\n```go\nfunc DeleteRepository(uid, repoId int64, userName string) error\n```\nDeleteRepository deletes a repository for a user or orgnaztion.\n\n```go\nfunc DeleteTeam(t *Team) error\n```\nDeleteTeam deletes given team. It's caller's responsibility to assign organization ID.\n\n```go\nfunc DeleteUser(u *User) error\n```\nTODO: need some kind of mechanism to record failure. DeleteUser completely and permanently deletes everything of user.\n\n```go\nfunc DeleteWebhook(hookId int64) error\n```\nDeleteWebhook deletes webhook of repository.\n\n```go\nfunc DeliverHooks()\n```\nDeliverHooks checks and delivers undelivered hooks.\n\n```go\nfunc DumpDatabase(filePath string) error\n```\nDumpDatabase dumps all data from database to file system.\n\n```go\nfunc FollowUser(userId int64, followId int64) (err error)\n```\nFollowUser marks someone be another's follower.\n\n```go\nfunc ForkRepository(repoName string, uid int64)\n```\n\n```go\nfunc GetCollaboratorNames(repoName string) ([]string, error)\n```\nGetCollaboratorNames returns a list of user name of repository's collaborators.\n\n```go\nfunc GetIssueCountByPoster(uid, rid int64, isClosed bool) int64\n```\nGetIssueCountByPoster returns number of issues of repository by poster.\n\n```go\nfunc GetRepositoryCount(user *User) (int64, error)\n```\nGetRepositoryCount returns the total number of repositories of user.\n\n```go\nfunc GetSlackURL(domain string, token string) string\n```\n\n```go\nfunc GetUserEmailsByNames(names []string) []string\n```\nGetUserEmailsByNames returns a slice of e-mails corresponds to names.\n\n```go\nfunc GetUserIdsByNames(names []string) []int64\n```\nGetUserIdsByNames returns a slice of ids corresponds to names.\n\n```go\nfunc GetUserSalt() string\n```\nGetUserSalt returns a user salt token\n\n```go\nfunc HasAccess(uname, repoName string, mode AccessType) (bool, error)\n```\nHasAccess returns true if someone can read or write to given repository. The repoName should be in format \\\u003cusername\u003e/\\\u003creponame\u003e.\n\n```go\nfunc IsEmailUsed(email string) (bool, error)\n```\nIsEmailUsed returns true if the e-mail has been used.\n\n```go\nfunc IsLegalName(repoName string) bool\n```\nIsLegalName returns false if name contains illegal characters.\n\n```go\nfunc IsOrganizationMember(orgId, uid int64) bool\n```\nIsOrganizationMember returns true if given user is member of organization.\n\n```go\nfunc IsOrganizationOwner(orgId, uid int64) bool\n```\nIsOrganizationOwner returns true if given user is in the owner team.\n\n```go\nfunc IsPublicMembership(orgId, uid int64) bool\n```\nIsPublicMembership returns ture if given user public his/her membership.\n\n```go\nfunc IsReleaseExist(repoId int64, tagName string) (bool, error)\n```\nIsReleaseExist returns true if release with given tag name already exists.\n\n```go\nfunc IsRepositoryExist(u *User, repoName string) (bool, error)\n```\nIsRepositoryExist returns true if the repository with given name under user has already existed.\n\n```go\nfunc IsStaring(uid, repoId int64) bool\n```\nIsStaring checks if user has starred given repository.\n\n```go\nfunc IsTeamMember(orgId, teamId, uid int64) bool\n```\nIsTeamMember returns true if given user is a member of team.\n\n```go\nfunc IsUserExist(name string) (bool, error)\n```\nIsUserExist checks if given user name exist, the user name should be noncased unique.\n\n```go\nfunc IsWatching(uid, rid int64) bool\n```\nIsWatching checks if user has watched given repository.\n\n```go\nfunc LoadModelsConfig()\n```\n\n```go\nfunc LoadRepoConfig()\n```\n\n```go\nfunc LoginAuth(username, password string) smtp.Auth\n```\n\n```go\nfunc MirrorRepository(repoId int64, userName, repoName, repoPath, url string) error\n```\nMirrorRepository creates a mirror repository from source.\n\n```go\nfunc MirrorUpdate()\n```\nMirrorUpdate checks and updates mirror repositories.\n\n```go\nfunc NewEngine() (err error)\n```\n\n```go\nfunc NewIssue(issue *Issue) (err error)\n```\nCreateIssue creates new issue for repository.\n\n```go\nfunc NewIssueUserPairs(rid, iid, oid, pid, aid int64, repoName string) (err error)\n```\nNewIssueUserPairs adds new issue-user pairs for new issue of repository.\n\n```go\nfunc NewLabel(l *Label) error\n```\nNewLabel creates new label of repository.\n\n```go\nfunc NewMilestone(m *Milestone) (err error)\n```\nNewMilestone creates new milestone of repository.\n\n```go\nfunc NewRepoAction(u *User, repo *Repository) (err error)\n```\nNewRepoAction adds new action for creating repository.\n\n```go\nfunc NewRepoContext()\n```\n\n```go\nfunc NewTeam(t *Team) error\n```\nNewTeam creates a record of new team. It's caller's responsibility to assign organization ID.\n\n```go\nfunc NewTestEngine(x *xorm.Engine) (err error)\n```\n\n```go\nfunc NotifyWatchers(act *Action) error\n```\nNotifyWatchers creates batch of actions for every watcher.\n\n```go\nfunc PairsContains(ius []*IssueUser, issueId int64) int\n```\nPairsContains returns true when pairs list contains given issue.\n\n```go\nfunc Ping() error\n```\n\n```go\nfunc RemoveOrgUser(orgId, uid int64) error\n```\nRemoveOrgUser removes user from given organization.\n\n```go\nfunc RemoveTeamMember(orgId, teamId, uid int64) error\n```\nRemoveTeamMember removes member from given team of given organization.\n\n```go\nfunc RepoPath(userName, repoName string) string\n```\nRepoPath returns repository path by given user and repository name.\n\n```go\nfunc SetEngine() (err error)\n```\n\n```go\nfunc SlackLinkFormatter(url string, text string) string\n```\n\n```go\nfunc SlackTextFormatter(s string) string\n```\nsee: [https://api.slack.com/docs/formatting](https://api.slack.com/docs/formatting)\n\n```go\nfunc SmtpAuth(host string, port int, a smtp.Auth, useTls bool) error\n```\n\n```go\nfunc SortReleases(rels []*Release)\n```\nSortReleases sorts releases by number of commits and created time.\n\n```go\nfunc StarRepo(uid, repoId int64, star bool) (err error)\n```\nStar or unstar repository.\n\n```go\nfunc TransferOwnership(u *User, newOwner string, repo *Repository) error\n```\nTransferOwnership transfers all corresponding setting from old user to new one.\n\n```go\nfunc TransferRepoAction(u, newUser *User, repo *Repository) (err error)\n```\nTransferRepoAction adds new action for transfering repository.\n\n```go\nfunc UnFollowUser(userId int64, unFollowId int64) (err error)\n```\nUnFollowUser unmarks someone be another's follower.\n\n```go\nfunc Update(refName, oldCommitId, newCommitId, userName, repoUserName, repoName string, userId int64) error\n```\n\n```go\nfunc UpdateAccess(access *Access) error\n```\nUpdateAccess updates access information.\n\n```go\nfunc UpdateAccessWithSession(sess *xorm.Session, access *Access) error\n```\nUpdateAccess updates access information with session for rolling back.\n\n```go\nfunc UpdateHookTask(t *HookTask) error\n```\nUpdateHookTask updates information of hook task.\n\n```go\nfunc UpdateIssue(issue *Issue) error\n```\nUpdateIssue updates information of issue.\n\n```go\nfunc UpdateIssueUserPairByAssignee(aid, iid int64) error\n```\nUpdateIssueUserPairByAssignee updates issue-user pair for assigning.\n\n```go\nfunc UpdateIssueUserPairByRead(uid, iid int64) error\n```\nUpdateIssueUserPairByRead updates issue-user pair for reading.\n\n```go\nfunc UpdateIssueUserPairsByMentions(uids []int64, iid int64) error\n```\nUpdateIssueUserPairsByMentions updates issue-user pairs by mentioning.\n\n```go\nfunc UpdateIssueUserPairsByStatus(iid int64, isClosed bool) error\n```\nUpdateIssueUserByStatus updates issue-user pairs by issue status.\n\n```go\nfunc UpdateLabel(l *Label) error\n```\nUpdateLabel updates label information.\n\n```go\nfunc UpdateMentions(userNames []string, issueId int64) error\n```\n\n```go\nfunc UpdateMilestone(m *Milestone) error\n```\nUpdateMilestone updates information of given milestone.\n\n```go\nfunc UpdateMirror(m *Mirror) error\n```\n\n```go\nfunc UpdateOauth2(oa *Oauth2) error\n```\nUpdateOauth2 updates given OAuth2.\n\n```go\nfunc UpdatePublicKey(key *PublicKey) error\n```\nUpdatePublicKey updates given public key.\n\n```go\nfunc UpdateRelease(gitRepo *git.Repository, rel *Release) (err error)\n```\nUpdateRelease updates information of a release.\n\n```go\nfunc UpdateRepository(repo *Repository) error\n```\n\n```go\nfunc UpdateSource(source *LoginSource) error\n```\n\n```go\nfunc UpdateTeam(t *Team, authChanged bool) (err error)\n```\nUpdateTeam updates information of team.\n\n```go\nfunc UpdateUser(u *User) error\n```\nUpdateUser updates user's information.\n\n```go\nfunc UpdateWebhook(w *Webhook) error\n```\nUpdateWebhook updates information of webhook.\n\n```go\nfunc UserPath(userName string) string\n```\nUserPath returns the path absolute path of user repositories.\n\n```go\nfunc WatchRepo(uid, repoId int64, watch bool) (err error)\n```\nWatch or unwatch repository.\n\n## Types\n\n```go\ntype Access struct {\n\tId       int64\n\tUserName string     `xorm:\"UNIQUE(s)\"`\n\tRepoName string     `xorm:\"UNIQUE(s)\"` // \u003cuser name\u003e/\u003crepo name\u003e\n\tMode     AccessType `xorm:\"UNIQUE(s)\"`\n\tCreated  time.Time  `xorm:\"CREATED\"`\n}\n```\nAccess represents the accessibility of user to repository.\n\n```go\ntype AccessType int\n```\n\n```go\nconst (\n\tREADABLE AccessType = iota + 1\n\tWRITABLE\n)\n```\n\n```go\nfunc AuthorizeToAccessType(auth AuthorizeType) AccessType\n```\n\n```go\ntype Action struct {\n\tId           int64\n\tUserId       int64 // Receiver user id.\n\tOpType       ActionType\n\tActUserId    int64  // Action user id.\n\tActUserName  string // Action user name.\n\tActEmail     string\n\tRepoId       int64\n\tRepoUserName string\n\tRepoName     string\n\tRefName      string\n\tIsPrivate    bool      `xorm:\"NOT NULL DEFAULT false\"`\n\tContent      string    `xorm:\"TEXT\"`\n\tCreated      time.Time `xorm:\"created\"`\n}\n```\nAction represents user operation type and other information to repository., it implemented interface base.Actioner so that can be used in template render.\n\n```go\nfunc GetFeeds(uid, offset int64, isProfile bool) ([]*Action, error)\n```\nGetFeeds returns action list of given user in given context.\n\n```go\nfunc (a Action) GetActEmail() string\n```\n\n```go\nfunc (a Action) GetActUserName() string\n```\n\n```go\nfunc (a Action) GetBranch() string\n```\n\n```go\nfunc (a Action) GetContent() string\n```\n\n```go\nfunc (a Action) GetCreate() time.Time\n```\n\n```go\nfunc (a Action) GetIssueInfos() []string\n```\n\n```go\nfunc (a Action) GetOpType() int\n```\n\n```go\nfunc (a Action) GetRepoLink() string\n```\n\n```go\nfunc (a Action) GetRepoName() string\n```\n\n```go\nfunc (a Action) GetRepoUserName() string\n```\n\n```go\ntype ActionType int\n```\n\n```go\nconst (\n\tCREATE_REPO   ActionType = iota + 1 // 1\n\tDELETE_REPO                         // 2\n\tSTAR_REPO                           // 3\n\tFOLLOW_REPO                         // 4\n\tCOMMIT_REPO                         // 5\n\tCREATE_ISSUE                        // 6\n\tPULL_REQUEST                        // 7\n\tTRANSFER_REPO                       // 8\n\tPUSH_TAG                            // 9\n\tCOMMENT_ISSUE                       // 10\n)\n```\n\n```go\ntype Attachment struct {\n\tId        int64\n\tIssueId   int64\n\tCommentId int64\n\tName      string\n\tPath      string    `xorm:\"TEXT\"`\n\tCreated   time.Time `xorm:\"CREATED\"`\n}\n```\n\n```go\nfunc CreateAttachment(issueId, commentId int64, name, path string) (*Attachment, error)\n```\nCreateAttachment creates a new attachment inside the database and\n\n```go\nfunc GetAttachmentById(id int64) (*Attachment, error)\n```\nAttachment returns the attachment by given ID.\n\n```go\nfunc GetAttachmentsByComment(commentId int64) ([]*Attachment, error)\n```\nGetAttachmentsByComment returns a list of attachments for the given comment\n\n```go\nfunc GetAttachmentsByIssue(issueId int64) ([]*Attachment, error)\n```\nGetAttachmentsByIssue returns a list of attachments for the given issue\n\n```go\nfunc GetAttachmentsForIssue(issueId int64) ([]*Attachment, error)\n```\n\n```go\ntype AuthorizeType int\n```\n\n```go\nconst (\n\tORG_READABLE AuthorizeType = iota + 1\n\tORG_WRITABLE\n\tORG_ADMIN\n)\n```\n\n```go\nfunc GetHighestAuthorize(orgId, uid, repoId, teamId int64) (AuthorizeType, error)\n```\nGetHighestAuthorize returns highest repository authorize level for given user and team.\n\n```go\ntype BasePayload interface {\n\tGetJSONPayload() ([]byte, error)\n}\n```\n\n```go\ntype Comment struct {\n\tId       int64\n\tType     CommentType\n\tPosterId int64\n\tPoster   *User `xorm:\"-\"`\n\tIssueId  int64\n\tCommitId int64\n\tLine     int64\n\tContent  string    `xorm:\"TEXT\"`\n\tCreated  time.Time `xorm:\"CREATED\"`\n}\n```\nComment represents a comment in commit and issue page.\n\n```go\nfunc CreateComment(userId, repoId, issueId, commitId, line int64, cmtType CommentType, content string, attachments []int64) (*Comment, error)\n```\nCreateComment creates comment of issue or commit.\n\n```go\nfunc GetCommentById(commentId int64) (*Comment, error)\n```\nGetCommentById returns the comment with the given id\n\n```go\nfunc GetIssueComments(issueId int64) ([]Comment, error)\n```\nGetIssueComments returns list of comment by given issue id.\n\n```go\nfunc (c *Comment) AfterDelete()\n```\n\n```go\nfunc (c *Comment) Attachments() []*Attachment\n```\nAttachments returns the attachments for this comment.\n\n```go\nfunc (c *Comment) ContentHtml() template.HTML\n```\n\n```go\ntype CommentType int\n```\nCommentType defines whether a comment is just a simple comment, an action (like close) or a reference.\n\n```go\nconst (\n\t// Plain comment, can be associated with a commit (CommitId \u003e 0) and a line (Line \u003e 0)\n\tCOMMENT CommentType = iota\n\n\t// Reopen action\n\tREOPEN\n\n\t// Close action\n\tCLOSE\n\n\t// Reference from another issue\n\tISSUE\n\n\t// Reference from some commit (not part of a pull request)\n\tCOMMIT\n\n\t// Reference from some pull request\n\tPULL\n)\n```\n\n```go\ntype Diff struct {\n\tTotalAddition, TotalDeletion int\n\tFiles                        []*DiffFile\n}\n```\n\n```go\nfunc GetDiffCommit(repoPath, commitId string, maxlines int) (*Diff, error)\n```\n\n```go\nfunc GetDiffRange(repoPath, beforeCommitId string, afterCommitId string, maxlines int) (*Diff, error)\n```\n\n```go\nfunc ParsePatch(pid int64, maxlines int, cmd *exec.Cmd, reader io.Reader) (*Diff, error)\n```\n\n```go\nfunc (diff *Diff) NumFiles() int\n```\n\n```go\ntype DiffFile struct {\n\tName               string\n\tIndex              int\n\tAddition, Deletion int\n\tType               int\n\tIsBin              bool\n\tSections           []*DiffSection\n}\n```\n\n```go\ntype DiffLine struct {\n\tLeftIdx  int\n\tRightIdx int\n\tType     int\n\tContent  string\n}\n```\n\n```go\nfunc (d DiffLine) GetType() int\n```\n\n```go\ntype DiffSection struct {\n\tName  string\n\tLines []*DiffLine\n}\n```\n\n```go\ntype Follow struct {\n\tId       int64\n\tUserId   int64 `xorm:\"unique(follow)\"`\n\tFollowId int64 `xorm:\"unique(follow)\"`\n}\n```\nFollow is connection request for receiving user notifycation.\n\n```go\ntype HookContentType int\n```\n\n```go\nconst (\n\tJSON HookContentType = iota + 1\n\tFORM\n)\n```\n\n```go\ntype HookEvent struct {\n\tPushOnly bool `json:\"push_only\"`\n}\n```\nHookEvent represents events that will delivery hook.\n\n```go\ntype HookEventType string\n```\n\n```go\nconst (\n\tPUSH HookEventType = \"push\"\n)\n```\n\n```go\ntype HookTask struct {\n\tId             int64\n\tUuid           string\n\tType           HookTaskType\n\tUrl            string\n\tBasePayload    `xorm:\"-\"`\n\tPayloadContent string `xorm:\"TEXT\"`\n\tContentType    HookContentType\n\tEventType      HookEventType\n\tIsSsl          bool\n\tIsDelivered    bool\n\tIsSucceed      bool\n}\n```\nHookTask represents a hook task.\n\n```go\ntype HookTaskType int\n```\n\n```go\nconst (\n\tGOGS HookTaskType = iota + 1\n\tSLACK\n)\n```\n\n```go\ntype Issue struct {\n\tId              int64\n\tRepoId          int64 `xorm:\"INDEX\"`\n\tIndex           int64 // Index in one repository.\n\tName            string\n\tRepo            *Repository `xorm:\"-\"`\n\tPosterId        int64\n\tPoster          *User    `xorm:\"-\"`\n\tLabelIds        string   `xorm:\"TEXT\"`\n\tLabels          []*Label `xorm:\"-\"`\n\tMilestoneId     int64\n\tAssigneeId      int64\n\tAssignee        *User `xorm:\"-\"`\n\tIsRead          bool  `xorm:\"-\"`\n\tIsPull          bool  // Indicates whether is a pull request or not.\n\tIsClosed        bool\n\tContent         string `xorm:\"TEXT\"`\n\tRenderedContent string `xorm:\"-\"`\n\tPriority        int\n\tNumComments     int\n\tDeadline        time.Time\n\tCreated         time.Time `xorm:\"CREATED\"`\n\tUpdated         time.Time `xorm:\"UPDATED\"`\n}\n```\nIssue represents an issue or pull request of repository.\n\n```go\nfunc GetIssueById(id int64) (*Issue, error)\n```\nGetIssueById returns an issue by ID.\n\n```go\nfunc GetIssueByIndex(rid, index int64) (*Issue, error)\n```\nGetIssueByIndex returns issue by given index in repository.\n\n```go\nfunc GetIssueByRef(ref string) (issue *Issue, err error)\n```\nGetIssueByRef returns an Issue specified by a GFM reference. See [https://help.github.com/articles/writing-on-github#references](https://help.github.com/articles/writing-on-github#references) for more information on the syntax.\n\n```go\nfunc GetIssues(uid, rid, pid, mid int64, page int, isClosed bool, labelIds, sortType string) ([]Issue, error)\n```\nGetIssues returns a list of issues by given conditions.\n\n```go\nfunc GetIssuesByLabel(repoId int64, label string) ([]*Issue, error)\n```\nGetIssuesByLabel returns a list of issues by given label and repository.\n\n```go\nfunc (i *Issue) AfterDelete()\n```\n\n```go\nfunc (i *Issue) Attachments() []*Attachment\n```\n\n```go\nfunc (i *Issue) GetAssignee() (err error)\n```\n\n```go\nfunc (i *Issue) GetLabels() error\n```\n\n```go\nfunc (i *Issue) GetPoster() (err error)\n```\n\n```go\ntype IssueStats struct {\n\tOpenCount, ClosedCount int64\n\tAllCount               int64\n\tAssignCount            int64\n\tCreateCount            int64\n\tMentionCount           int64\n}\n```\nIssueStats represents issue statistic information.\n\n```go\nfunc GetIssueStats(rid, uid int64, isShowClosed bool, filterMode int) *IssueStats\n```\nGetIssueStats returns issue statistic information by given conditions.\n\n```go\nfunc GetUserIssueStats(uid int64, filterMode int) *IssueStats\n```\nGetUserIssueStats returns issue statistic information for dashboard by given conditions.\n\n```go\ntype IssueStatus int\n```\n\n```go\ntype IssueUser struct {\n\tId          int64\n\tUid         int64 `xorm:\"INDEX\"` // User ID.\n\tIssueId     int64\n\tRepoId      int64 `xorm:\"INDEX\"`\n\tMilestoneId int64\n\tIsRead      bool\n\tIsAssigned  bool\n\tIsMentioned bool\n\tIsPoster    bool\n\tIsClosed    bool\n}\n```\nIssueUser represents an issue-user relation.\n\n```go\nfunc GetIssueUserPairs(rid, uid int64, isClosed bool) ([]*IssueUser, error)\n```\nGetIssueUserPairs returns issue-user pairs by given repository and user.\n\n```go\nfunc GetIssueUserPairsByMode(uid, rid int64, isClosed bool, page, filterMode int) ([]*IssueUser, error)\n```\nGetIssueUserPairsByMode returns issue-user pairs by given repository and user.\n\n```go\nfunc GetIssueUserPairsByRepoIds(rids []int64, isClosed bool, page int) ([]*IssueUser, error)\n```\nGetIssueUserPairsByRepoIds returns issue-user pairs by given repository IDs.\n\n```go\ntype LDAPConfig struct {\n\tldap.Ldapsource\n}\n```\n\n```go\nfunc (cfg *LDAPConfig) FromDB(bs []byte) error\n```\n\n```go\nfunc (cfg *LDAPConfig) ToDB() ([]byte, error)\n```\n\n```go\ntype Label struct {\n\tId              int64\n\tRepoId          int64 `xorm:\"INDEX\"`\n\tName            string\n\tColor           string `xorm:\"VARCHAR(7)\"`\n\tNumIssues       int\n\tNumClosedIssues int\n\tNumOpenIssues   int  `xorm:\"-\"`\n\tIsChecked       bool `xorm:\"-\"`\n}\n```\nLabel represents a label of repository for issues.\n\n```go\nfunc GetLabelById(id int64) (*Label, error)\n```\nGetLabelById returns a label by given ID.\n\n```go\nfunc GetLabels(repoId int64) ([]*Label, error)\n```\nGetLabels returns a list of labels of given repository ID.\n\n```go\nfunc (m *Label) CalOpenIssues()\n```\nCalOpenIssues calculates the open issues of label.\n\n```go\ntype LoginSource struct {\n\tId                int64\n\tType              LoginType\n\tName              string          `xorm:\"UNIQUE\"`\n\tIsActived         bool            `xorm:\"NOT NULL DEFAULT false\"`\n\tCfg               core.Conversion `xorm:\"TEXT\"`\n\tAllowAutoRegister bool            `xorm:\"NOT NULL DEFAULT false\"`\n\tCreated           time.Time       `xorm:\"CREATED\"`\n\tUpdated           time.Time       `xorm:\"UPDATED\"`\n}\n```\n\n```go\nfunc GetAuths() ([]*LoginSource, error)\n```\n\n```go\nfunc GetLoginSourceById(id int64) (*LoginSource, error)\n```\n\n```go\nfunc (source *LoginSource) BeforeSet(colName string, val xorm.Cell)\n```\n\n```go\nfunc (source *LoginSource) LDAP() *LDAPConfig\n```\n\n```go\nfunc (source *LoginSource) SMTP() *SMTPConfig\n```\n\n```go\nfunc (source *LoginSource) TypeString() string\n```\n\n```go\ntype LoginType int\n```\n\n```go\nconst (\n\tNOTYPE LoginType = iota\n\tPLAIN\n\tLDAP\n\tSMTP\n)\n```\n\n```go\ntype Milestone struct {\n\tId              int64\n\tRepoId          int64 `xorm:\"INDEX\"`\n\tIndex           int64\n\tName            string\n\tContent         string `xorm:\"TEXT\"`\n\tRenderedContent string `xorm:\"-\"`\n\tIsClosed        bool\n\tNumIssues       int\n\tNumClosedIssues int\n\tNumOpenIssues   int `xorm:\"-\"`\n\tCompleteness    int // Percentage(1-100).\n\tDeadline        time.Time\n\tDeadlineString  string `xorm:\"-\"`\n\tClosedDate      time.Time\n}\n```\nMilestone represents a milestone of repository.\n\n```go\nfunc GetMilestoneById(id int64) (*Milestone, error)\n```\nGetMilestoneById returns the milestone by given ID.\n\n```go\nfunc GetMilestoneByIndex(repoId, idx int64) (*Milestone, error)\n```\nGetMilestoneByIndex returns the milestone of given repository and index.\n\n```go\nfunc GetMilestones(repoId int64, isClosed bool) ([]*Milestone, error)\n```\nGetMilestones returns a list of milestones of given repository and status.\n\n```go\nfunc (m *Milestone) CalOpenIssues()\n```\nCalOpenIssues calculates the open issues of milestone.\n\n```go\ntype Mirror struct {\n\tId         int64\n\tRepoId     int64\n\tRepoName   string    // \u003cuser name\u003e/\u003crepo name\u003e\n\tInterval   int       // Hour.\n\tUpdated    time.Time `xorm:\"UPDATED\"`\n\tNextUpdate time.Time\n}\n```\nMirror represents a mirror information of repository.\n\n```go\nfunc GetMirror(repoId int64) (*Mirror, error)\n```\n\n```go\ntype Oauth2 struct {\n\tId                int64\n\tUid               int64     `xorm:\"unique(s)\"` // userId\n\tUser              *User     `xorm:\"-\"`\n\tType              int       `xorm:\"unique(s) unique(oauth)\"` // twitter,github,google...\n\tIdentity          string    `xorm:\"unique(s) unique(oauth)\"` // id..\n\tToken             string    `xorm:\"TEXT not null\"`\n\tCreated           time.Time `xorm:\"CREATED\"`\n\tUpdated           time.Time\n\tHasRecentActivity bool `xorm:\"-\"`\n}\n```\n\n```go\nfunc GetOauth2(identity string) (oa *Oauth2, err error)\n```\n\n```go\nfunc GetOauth2ById(id int64) (oa *Oauth2, err error)\n```\n\n```go\nfunc GetOauthByUserId(uid int64) ([]*Oauth2, error)\n```\nGetOauthByUserId returns list of oauthes that are releated to given user.\n\n```go\ntype OauthType int\n```\n\n```go\nconst (\n\tGITHUB OauthType = iota + 1\n\tGOOGLE\n\tTWITTER\n\tQQ\n\tWEIBO\n\tBITBUCKET\n\tFACEBOOK\n)\n```\n\n```go\ntype OrgUser struct {\n\tId       int64\n\tUid      int64 `xorm:\"INDEX UNIQUE(s)\"`\n\tOrgId    int64 `xorm:\"INDEX UNIQUE(s)\"`\n\tIsPublic bool\n\tIsOwner  bool\n\tNumTeams int\n}\n```\nOrgUser represents an organization-user relation.\n\n```go\nfunc GetOrgUsersByOrgId(orgId int64) ([]*OrgUser, error)\n```\nGetOrgUsersByOrgId returns all organization-user relations by organization ID.\n\n```go\nfunc GetOrgUsersByUserId(uid int64) ([]*OrgUser, error)\n```\nGetOrgUsersByUserId returns all organization-user relations by user ID.\n\n```go\ntype Payload struct {\n\tSecret     string           `json:\"secret\"`\n\tRef        string           `json:\"ref\"`\n\tCommits    []*PayloadCommit `json:\"commits\"`\n\tRepo       *PayloadRepo     `json:\"repository\"`\n\tPusher     *PayloadAuthor   `json:\"pusher\"`\n\tBefore     string           `json:\"before\"`\n\tAfter      string           `json:\"after\"`\n\tCompareUrl string           `json:\"compare_url\"`\n}\n```\nPayload represents a payload information of hook.\n\n```go\nfunc (p Payload) GetJSONPayload() ([]byte, error)\n```\n\n```go\ntype PayloadAuthor struct {\n\tName     string `json:\"name\"`\n\tEmail    string `json:\"email\"`\n\tUserName string `json:\"username\"`\n}\n```\n\n```go\ntype PayloadCommit struct {\n\tId      string         `json:\"id\"`\n\tMessage string         `json:\"message\"`\n\tUrl     string         `json:\"url\"`\n\tAuthor  *PayloadAuthor `json:\"author\"`\n}\n```\n\n```go\ntype PayloadRepo struct {\n\tId          int64          `json:\"id\"`\n\tName        string         `json:\"name\"`\n\tUrl         string         `json:\"url\"`\n\tDescription string         `json:\"description\"`\n\tWebsite     string         `json:\"website\"`\n\tWatchers    int            `json:\"watchers\"`\n\tOwner       *PayloadAuthor `json:\"owner\"`\n\tPrivate     bool           `json:\"private\"`\n}\n```\n\n```go\ntype PublicKey struct {\n\tId                int64\n\tOwnerId           int64  `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tName              string `xorm:\"UNIQUE(s) NOT NULL\"`\n\tFingerprint       string\n\tContent           string    `xorm:\"TEXT NOT NULL\"`\n\tCreated           time.Time `xorm:\"CREATED\"`\n\tUpdated           time.Time\n\tHasRecentActivity bool `xorm:\"-\"`\n\tHasUsed           bool `xorm:\"-\"`\n}\n```\nPublicKey represents a SSH key.\n\n```go\nfunc GetPublicKeyById(keyId int64) (*PublicKey, error)\n```\nGetPublicKeyById returns public key by given ID.\n\n```go\nfunc ListPublicKey(uid int64) ([]*PublicKey, error)\n```\nListPublicKey returns a list of all public keys that user has.\n\n```go\nfunc (key *PublicKey) GetAuthorizedString() string\n```\nGetAuthorizedString generates and returns formatted public key string for authorized\\_keys file.\n\n```go\ntype Release struct {\n\tId               int64\n\tRepoId           int64\n\tPublisherId      int64\n\tPublisher        *User `xorm:\"-\"`\n\tTagName          string\n\tLowerTagName     string\n\tTarget           string\n\tTitle            string\n\tSha1             string `xorm:\"VARCHAR(40)\"`\n\tNumCommits       int\n\tNumCommitsBehind int    `xorm:\"-\"`\n\tNote             string `xorm:\"TEXT\"`\n\tIsDraft          bool   `xorm:\"NOT NULL DEFAULT false\"`\n\tIsPrerelease     bool\n\tCreated          time.Time `xorm:\"CREATED\"`\n}\n```\nRelease represents a release of repository.\n\n```go\nfunc GetRelease(repoId int64, tagName string) (*Release, error)\n```\nGetRelease returns release by given ID.\n\n```go\nfunc GetReleasesByRepoId(repoId int64) (rels []*Release, err error)\n```\nGetReleasesByRepoId returns a list of releases of repository.\n\n```go\ntype ReleaseSorter struct {\n\t// contains filtered or unexported fields\n}\n```\n\n```go\nfunc (rs *ReleaseSorter) Len() int\n```\n\n```go\nfunc (rs *ReleaseSorter) Less(i, j int) bool\n```\n\n```go\nfunc (rs *ReleaseSorter) Swap(i, j int)\n```\n\n```go\ntype Repository struct {\n\tId                  int64\n\tOwnerId             int64 `xorm:\"UNIQUE(s)\"`\n\tOwner               *User `xorm:\"-\"`\n\tForkId              int64\n\tLowerName           string `xorm:\"UNIQUE(s) INDEX NOT NULL\"`\n\tName                string `xorm:\"INDEX NOT NULL\"`\n\tDescription         string\n\tWebsite             string\n\tNumWatches          int\n\tNumStars            int\n\tNumForks            int\n\tNumIssues           int\n\tNumClosedIssues     int\n\tNumOpenIssues       int `xorm:\"-\"`\n\tNumPulls            int\n\tNumClosedPulls      int\n\tNumOpenPulls        int `xorm:\"-\"`\n\tNumMilestones       int `xorm:\"NOT NULL DEFAULT 0\"`\n\tNumClosedMilestones int `xorm:\"NOT NULL DEFAULT 0\"`\n\tNumOpenMilestones   int `xorm:\"-\"`\n\tNumTags             int `xorm:\"-\"`\n\tIsPrivate           bool\n\tIsMirror            bool\n\t*Mirror             `xorm:\"-\"`\n\tIsFork              bool `xorm:\"NOT NULL DEFAULT false\"`\n\tIsBare              bool\n\tIsGoget             bool\n\tDefaultBranch       string\n\tCreated             time.Time `xorm:\"CREATED\"`\n\tUpdated             time.Time `xorm:\"UPDATED\"`\n}\n```\nRepository represents a git repository.\n\n```go\nfunc CreateRepository(u *User, name, desc, lang, license string, private, mirror, initReadme bool) (*Repository, error)\n```\nCreateRepository creates a repository for given user or organization.\n\n```go\nfunc GetCollaborativeRepos(uname string) ([]*Repository, error)\n```\nGetCollaborativeRepos returns a list of repositories that user is collaborator.\n\n```go\nfunc GetRecentUpdatedRepositories(num int) (repos []*Repository, err error)\n```\nGetRecentUpdatedRepositories returns the list of repositories that are recently updated.\n\n```go\nfunc GetRepositories(uid int64, private bool) ([]*Repository, error)\n```\nGetRepositories returns a list of repositories of given user.\n\n```go\nfunc GetRepositoriesWithUsers(num, offset int) ([]*Repository, error)\n```\nGetRepositoriesWithUsers returns given number of repository objects with offset. It also auto-gets corresponding users.\n\n```go\nfunc GetRepositoryById(id int64) (*Repository, error)\n```\nGetRepositoryById returns the repository by given id if exists.\n\n```go\nfunc GetRepositoryByName(uid int64, repoName string) (*Repository, error)\n```\nGetRepositoryByName returns the repository by given name under user if exists.\n\n```go\nfunc GetRepositoryByRef(ref string) (*Repository, error)\n```\nGetRepositoryByRef returns a Repository specified by a GFM reference. See [https://help.github.com/articles/writing-on-github#references](https://help.github.com/articles/writing-on-github#references) for more information on the syntax.\n\n```go\nfunc MigrateRepository(u *User, name, desc string, private, mirror bool, url string) (*Repository, error)\n```\nMigrateRepository migrates a existing repository from other project hosting.\n\n```go\nfunc SearchRepositoryByName(opt SearchOption) (repos []*Repository, err error)\n```\nSearchRepositoryByName returns given number of repositories whose name contains keyword.\n\n```go\nfunc (repo *Repository) DescriptionHtml() template.HTML\n```\nDescriptionHtml does special handles to description and return HTML string.\n\n```go\nfunc (repo *Repository) GetMirror() (err error)\n```\n\n```go\nfunc (repo *Repository) GetOwner() (err error)\n```\n\n```go\ntype SMTPConfig struct {\n\tAuth string\n\tHost string\n\tPort int\n\tTLS  bool\n}\n```\n\n```go\nfunc (cfg *SMTPConfig) FromDB(bs []byte) error\n```\n\n```go\nfunc (cfg *SMTPConfig) ToDB() ([]byte, error)\n```\n\n```go\ntype SearchOption struct {\n\tKeyword string\n\tUid     int64\n\tLimit   int\n}\n```\n\n```go\ntype Slack struct {\n\tDomain  string `json:\"domain\"`\n\tToken   string `json:\"token\"`\n\tChannel string `json:\"channel\"`\n}\n```\n\n```go\ntype SlackAttachment struct {\n\tColor string `json:\"color\"`\n\tText  string `json:\"text\"`\n}\n```\n\n```go\ntype SlackPayload struct {\n\tChannel     string            `json:\"channel\"`\n\tText        string            `json:\"text\"`\n\tUsername    string            `json:\"username\"`\n\tIconUrl     string            `json:\"icon_url\"`\n\tUnfurlLinks int               `json:\"unfurl_links\"`\n\tLinkNames   int               `json:\"link_names\"`\n\tAttachments []SlackAttachment `json:\"attachments\"`\n}\n```\n\n```go\nfunc GetSlackPayload(p *Payload, meta string) (*SlackPayload, error)\n```\n\n```go\nfunc (p SlackPayload) GetJSONPayload() ([]byte, error)\n```\n\n```go\ntype Star struct {\n\tId     int64\n\tUid    int64 `xorm:\"UNIQUE(s)\"`\n\tRepoId int64 `xorm:\"UNIQUE(s)\"`\n}\n```\n\n```go\ntype Statistic struct {\n\tCounter struct {\n\t\tUser, Org, PublicKey,\n\t\tRepo, Watch, Star, Action, Access,\n\t\tIssue, Comment, Oauth, Follow,\n\t\tMirror, Release, LoginSource, Webhook,\n\t\tMilestone, Label, HookTask,\n\t\tTeam, UpdateTask, Attachment int64\n\t}\n}\n```\n\n```go\nfunc GetStatistic() (stats Statistic)\n```\n\n```go\ntype Team struct {\n\tId          int64\n\tOrgId       int64 `xorm:\"INDEX\"`\n\tLowerName   string\n\tName        string\n\tDescription string\n\tAuthorize   AuthorizeType\n\tRepoIds     string        `xorm:\"TEXT\"`\n\tRepos       []*Repository `xorm:\"-\"`\n\tMembers     []*User       `xorm:\"-\"`\n\tNumRepos    int\n\tNumMembers  int\n}\n```\nTeam represents a organization team.\n\n```go\nfunc GetTeam(orgId int64, name string) (*Team, error)\n```\nGetTeam returns team by given team name and organization.\n\n```go\nfunc GetTeamById(teamId int64) (*Team, error)\n```\nGetTeamById returns team by given ID.\n\n```go\nfunc GetUserTeams(orgId, uid int64) ([]*Team, error)\n```\nGetUserTeams returns all teams that user belongs to in given origanization.\n\n```go\nfunc (t *Team) AddMember(uid int64) error\n```\nAddMember adds new member to team of organization.\n\n```go\nfunc (t *Team) AddRepository(repo *Repository) (err error)\n```\nAddRepository adds new repository to team of organization.\n\n```go\nfunc (t *Team) GetMembers() (err error)\n```\nGetMembers returns all members in team of organization.\n\n```go\nfunc (t *Team) GetRepositories() error\n```\nGetRepositories returns all repositories in team of organization.\n\n```go\nfunc (t *Team) IsMember(uid int64) bool\n```\nIsTeamMember returns true if given user is a member of team.\n\n```go\nfunc (t *Team) IsOwnerTeam() bool\n```\nIsOwnerTeam returns true if team is owner team.\n\n```go\nfunc (t *Team) RemoveMember(uid int64) error\n```\nRemoveMember removes member from team of organization.\n\n```go\nfunc (t *Team) RemoveRepository(repoId int64) error\n```\nRemoveRepository removes repository from team of organization.\n\n```go\ntype TeamUser struct {\n\tId     int64\n\tUid    int64\n\tOrgId  int64 `xorm:\"INDEX\"`\n\tTeamId int64\n}\n```\nTeamUser represents an team-user relation.\n\n```go\ntype UpdateTask struct {\n\tId          int64\n\tUuid        string `xorm:\"index\"`\n\tRefName     string\n\tOldCommitId string\n\tNewCommitId string\n}\n```\n\n```go\nfunc GetUpdateTasksByUuid(uuid string) ([]*UpdateTask, error)\n```\n\n```go\ntype User struct {\n\tId            int64\n\tLowerName     string `xorm:\"UNIQUE NOT NULL\"`\n\tName          string `xorm:\"UNIQUE NOT NULL\"`\n\tFullName      string\n\tEmail         string `xorm:\"UNIQUE NOT NULL\"`\n\tPasswd        string `xorm:\"NOT NULL\"`\n\tLoginType     LoginType\n\tLoginSource   int64 `xorm:\"NOT NULL DEFAULT 0\"`\n\tLoginName     string\n\tType          UserType\n\tOrgs          []*User       `xorm:\"-\"`\n\tRepos         []*Repository `xorm:\"-\"`\n\tNumFollowers  int\n\tNumFollowings int\n\tNumStars      int\n\tNumRepos      int\n\tAvatar        string `xorm:\"VARCHAR(2048) NOT NULL\"`\n\tAvatarEmail   string `xorm:\"NOT NULL\"`\n\tLocation      string\n\tWebsite       string\n\tIsActive      bool\n\tIsAdmin       bool\n\tRands         string    `xorm:\"VARCHAR(10)\"`\n\tSalt          string    `xorm:\"VARCHAR(10)\"`\n\tCreated       time.Time `xorm:\"CREATED\"`\n\tUpdated       time.Time `xorm:\"UPDATED\"`\n\n\t// For organization.\n\tDescription string\n\tNumTeams    int\n\tNumMembers  int\n\tTeams       []*Team `xorm:\"-\"`\n\tMembers     []*User `xorm:\"-\"`\n}\n```\nUser represents the object of individual and member of organization.\n\n```go\nfunc CreateOrganization(org, owner *User) (*User, error)\n```\nCreateOrganization creates record of a new organization.\n\n```go\nfunc GetCollaborators(repoName string) (us []*User, err error)\n```\nGetCollaborators returns a list of users of repository's collaborators.\n\n```go\nfunc GetOrganizations(num, offset int) ([]*User, error)\n```\nGetOrganizations returns given number of organizations with offset.\n\n```go\nfunc GetTeamMembers(orgId, teamId int64) ([]*User, error)\n```\nGetTeamMembers returns all members in given team of organization.\n\n```go\nfunc GetUserByEmail(email string) (*User, error)\n```\nGetUserByEmail returns the user object by given e-mail if exists.\n\n```go\nfunc GetUserById(id int64) (*User, error)\n```\nGetUserById returns the user object by given ID if exists.\n\n```go\nfunc GetUserByKeyId(keyId int64) (*User, error)\n```\n\n```go\nfunc GetUserByName(name string) (*User, error)\n```\nGetUserByName returns the user object by given name if exists.\n\n```go\nfunc GetUsers(num, offset int) ([]*User, error)\n```\nGetUsers returns given number of user objects with offset.\n\n```go\nfunc LoginUserLdapSource(u *User, name, passwd string, sourceId int64, cfg *LDAPConfig, autoRegister bool) (*User, error)\n```\nQuery if name/passwd can login against the LDAP direcotry pool Create a local user if success Return the same LoginUserPlain semantic\n\n```go\nfunc LoginUserSMTPSource(u *User, name, passwd string, sourceId int64, cfg *SMTPConfig, autoRegister bool) (*User, error)\n```\nQuery if name/passwd can login against the LDAP direcotry pool Create a local user if success Return the same LoginUserPlain semantic\n\n```go\nfunc SearchUserByName(opt SearchOption) (us []*User, err error)\n```\nSearchUserByName returns given number of users whose name contains keyword.\n\n```go\nfunc UserSignIn(uname, passwd string) (*User, error)\n```\nUserSignIn validates user name and password.\n\n```go\nfunc VerifyUserActiveCode(code string) (user *User)\n```\nverify active code when active account\n\n```go\nfunc (org *User) AddMember(uid int64) error\n```\nAddMember adds new member to organization.\n\n```go\nfunc (u *User) AvatarLink() string\n```\nAvatarLink returns user gravatar link.\n\n```go\nfunc (u *User) DashboardLink() string\n```\nDashboardLink returns the user dashboard page link.\n\n```go\nfunc (u *User) EncodePasswd()\n```\nEncodePasswd encodes password to safe format.\n\n```go\nfunc (u *User) GetFullNameFallback() string\n```\nGetFullNameFallback returns Full Name if set, otherwise username\n\n```go\nfunc (org *User) GetMembers() error\n```\nGetMembers returns all members of organization.\n\n```go\nfunc (u *User) GetOrganizationCount() (int64, error)\n```\nGetOrganizationCount returns count of membership of organization of user.\n\n```go\nfunc (u *User) GetOrganizations() error\n```\nGetOrganizations returns all organizations that user belongs to.\n\n```go\nfunc (org *User) GetOwnerTeam() (*Team, error)\n```\nGetOwnerTeam returns owner team of organization.\n\n```go\nfunc (u *User) GetRepositories() (err error)\n```\nGetRepositories returns all repositories that user owns, including private repositories.\n\n```go\nfunc (org *User) GetTeam(name string) (*Team, error)\n```\nGetTeam returns named team of organization.\n\n```go\nfunc (org *User) GetTeams() error\n```\nGetTeams returns all teams that belong to organization.\n\n```go\nfunc (u *User) HomeLink() string\n```\nHomeLink returns the user home page link.\n\n```go\nfunc (org *User) IsOrgMember(uid int64) bool\n```\nIsOrgMember returns true if given user is member of organization.\n\n```go\nfunc (org *User) IsOrgOwner(uid int64) bool\n```\nIsOrgOwner returns true if given user is in the owner team.\n\n```go\nfunc (u *User) IsOrganization() bool\n```\nIsOrganization returns true if user is actually a organization.\n\n```go\nfunc (u *User) IsPublicMember(orgId int64) bool\n```\nIsPublicMember returns true if user public his/her membership in give organization.\n\n```go\nfunc (u *User) IsUserOrgOwner(orgId int64) bool\n```\nIsUserOrgOwner returns true if user is in the owner team of given organization.\n\n```go\nfunc (u *User) NewGitSig() *git.Signature\n```\nNewGitSig generates and returns the signature of given user.\n\n```go\nfunc (org *User) RemoveMember(uid int64) error\n```\nRemoveMember removes member from organization.\n\n```go\nfunc (u *User) ValidtePassword(passwd string) bool\n```\nValidtePassword checks if given password matches the one belongs to the user.\n\n```go\ntype UserType int\n```\n\n```go\nconst (\n\tINDIVIDUAL UserType = iota // Historic reason to make it starts at 0.\n\tORGANIZATION\n)\n```\n\n```go\ntype Watch struct {\n\tId     int64\n\tUserId int64 `xorm:\"UNIQUE(watch)\"`\n\tRepoId int64 `xorm:\"UNIQUE(watch)\"`\n}\n```\nWatch is connection request for receiving repository notifycation.\n\n```go\nfunc GetWatchers(rid int64) ([]*Watch, error)\n```\nGetWatchers returns all watchers of given repository.\n\n```go\ntype Webhook struct {\n\tId           int64\n\tRepoId       int64\n\tUrl          string `xorm:\"TEXT\"`\n\tContentType  HookContentType\n\tSecret       string `xorm:\"TEXT\"`\n\tEvents       string `xorm:\"TEXT\"`\n\t*HookEvent   `xorm:\"-\"`\n\tIsSsl        bool\n\tIsActive     bool\n\tHookTaskType HookTaskType\n\tMeta         string `xorm:\"TEXT\"` // store hook-specific attributes\n\tOrgId        int64\n}\n```\nWebhook represents a web hook object.\n\n```go\nfunc GetActiveWebhooksByOrgId(orgId int64) (ws []*Webhook, err error)\n```\nGetActiveWebhooksByOrgId returns all active webhooks for an organization.\n\n```go\nfunc GetActiveWebhooksByRepoId(repoId int64) (ws []*Webhook, err error)\n```\nGetActiveWebhooksByRepoId returns all active webhooks of repository.\n\n```go\nfunc GetWebhookById(hookId int64) (*Webhook, error)\n```\nGetWebhookById returns webhook by given ID.\n\n```go\nfunc GetWebhooksByOrgId(orgId int64) (ws []*Webhook, err error)\n```\nGetWebhooksByOrgId returns all webhooks for an organization.\n\n```go\nfunc GetWebhooksByRepoId(repoId int64) (ws []*Webhook, err error)\n```\nGetWebhooksByRepoId returns all webhooks of repository.\n\n```go\nfunc (w *Webhook) GetEvent()\n```\nGetEvent handles conversion from Events to HookEvent.\n\n```go\nfunc (w *Webhook) GetSlackHook() *Slack\n```\n\n```go\nfunc (w *Webhook) HasPushEvent() bool\n```\nHasPushEvent returns true if hook enbaled push event.\n\n```go\nfunc (w *Webhook) UpdateEvent() error\n```\nUpdateEvent handles conversion from HookEvent to Events.\n\n","path":"github.com/developerspl/gogs/models","name":"models","synopsis":"","isRedistributable":true}
