models

package
v1.17.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 30, 2022 License: MIT Imports: 47 Imported by: 1,618

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AccessTokenByNameExists added in v1.12.0

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

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

func AddAllRepositories added in v1.17.0

func AddAllRepositories(t *organization.Team) (err error)

AddAllRepositories adds all repositories to the team

func AddCollaborator added in v1.16.0

func AddCollaborator(repo *repo_model.Repository, u *user_model.User) error

AddCollaborator adds new collaboration to a repository with default access mode.

func AddReleaseAttachments added in v1.10.0

func AddReleaseAttachments(ctx context.Context, releaseID int64, attachmentUUIDs []string) (err error)

AddReleaseAttachments adds a release attachments

func AddRepository added in v1.17.0

func AddRepository(t *organization.Team, repo *repo_model.Repository) (err error)

AddRepository adds new repository to team of organization.

func AddTeamMember

func AddTeamMember(team *organization.Team, userID int64) error

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

func CancelRepositoryTransfer added in v1.14.0

func CancelRepositoryTransfer(repo *repo_model.Repository) error

CancelRepositoryTransfer marks the repository as ready and remove pending transfer entry, thus cancel the transfer process.

func CheckRepoStats

func CheckRepoStats(ctx context.Context) error

CheckRepoStats checks the repository stats

func CheckRepoUnitUser added in v1.16.0

func CheckRepoUnitUser(ctx context.Context, repo *repo_model.Repository, user *user_model.User, unitType unit.Type) bool

CheckRepoUnitUser check whether user could visit the unit of this repository

func CountAccessTokens added in v1.16.0

func CountAccessTokens(opts ListAccessTokensOptions) (int64, error)

CountAccessTokens count access tokens belongs to given user by options

func CountActionCreatedUnixString added in v1.16.8

func CountActionCreatedUnixString() (int64, error)

CountActionCreatedUnixString count actions where created_unix is an empty string

func CountNotifications added in v1.16.0

func CountNotifications(opts *FindNotificationOptions) (int64, error)

CountNotifications count all notifications that fit to the given options and ignore pagination.

func CountNullArchivedRepository added in v1.12.0

func CountNullArchivedRepository() (int64, error)

CountNullArchivedRepository counts the number of repositories with is_archived is null

func CountReleasesByRepoID added in v1.15.0

func CountReleasesByRepoID(repoID int64, opts FindReleasesOptions) (int64, error)

CountReleasesByRepoID returns a number of releases matching FindReleaseOptions and RepoID.

func CountUnread added in v1.12.0

func CountUnread(ctx context.Context, userID int64) int64

CountUnread count unread notifications for a user

func CountWrongUserType added in v1.14.0

func CountWrongUserType() (int64, error)

CountWrongUserType count OrgUser who have wrong type

func CreateOrUpdateIssueNotifications added in v1.1.0

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

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

func CreatePendingRepositoryTransfer added in v1.14.0

func CreatePendingRepositoryTransfer(doer, newOwner *user_model.User, repoID int64, teams []*organization.Team) error

CreatePendingRepositoryTransfer transfer a repo from one owner to a new one. it marks the repository transfer as "pending"

func CreateRepoTransferNotification added in v1.14.0

func CreateRepoTransferNotification(doer, newOwner *user_model.User, repo *repo_model.Repository) error

CreateRepoTransferNotification creates notification for the user a repository was transferred to

func CreateRepository

func CreateRepository(ctx context.Context, doer, u *user_model.User, repo *repo_model.Repository, overwriteOrAdopt bool) (err error)

CreateRepository creates a repository for the user/organization.

func CreateTask added in v1.12.0

func CreateTask(task *Task) error

CreateTask creates a task on database

func DeleteAccessTokenByID

func DeleteAccessTokenByID(id, userID int64) error

DeleteAccessTokenByID deletes access token by given ID.

func DeleteCollaboration added in v1.16.0

func DeleteCollaboration(repo *repo_model.Repository, uid int64) (err error)

DeleteCollaboration removes collaboration relation between the user and repository.

func DeleteDeployKey

func DeleteDeployKey(ctx context.Context, doer *user_model.User, id int64) error

DeleteDeployKey delete deploy keys

func DeleteIssueActions added in v1.17.0

func DeleteIssueActions(ctx context.Context, repoID, issueID int64) error

DeleteIssueActions delete all actions related with issueID

func DeleteOldActions added in v1.15.0

func DeleteOldActions(olderThan time.Duration) (err error)

DeleteOldActions deletes all old actions from database.

func DeleteReleaseByID

func DeleteReleaseByID(id int64) error

DeleteReleaseByID deletes a release from database by given ID.

func DeleteRepository

func DeleteRepository(doer *user_model.User, uid, repoID int64) error

DeleteRepository deletes a repository for a user or organization. make sure if you call this func to close open sessions (sqlite will otherwise get a deadlock)

func DeleteTeam

func DeleteTeam(t *organization.Team) error

DeleteTeam deletes given team. It's caller's responsibility to assign organization ID.

func DeleteUploadByUUID

func DeleteUploadByUUID(uuid string) error

DeleteUploadByUUID deletes a upload by UUID

func DeleteUploads

func DeleteUploads(uploads ...*Upload) (err error)

DeleteUploads deletes multiple uploads

func DeleteUser

func DeleteUser(ctx context.Context, u *user_model.User) (err error)

DeleteUser deletes models associated to an user.

func DoctorUserStarNum added in v1.12.2

func DoctorUserStarNum() (err error)

DoctorUserStarNum recalculate Stars number for all user

func FinishMigrateTask added in v1.10.0

func FinishMigrateTask(task *Task) error

FinishMigrateTask updates database when migrate task finished

func FixActionCreatedUnixString added in v1.16.8

func FixActionCreatedUnixString() (int64, error)

FixActionCreatedUnixString set created_unix to zero if it is an empty string

func FixNullArchivedRepository added in v1.12.0

func FixNullArchivedRepository() (int64, error)

FixNullArchivedRepository sets is_archived to false where it is null

func FixWrongUserType added in v1.14.0

func FixWrongUserType() (int64, error)

FixWrongUserType fix OrgUser who have wrong type

func GetNotificationCount added in v1.1.0

func GetNotificationCount(ctx context.Context, user *user_model.User, status NotificationStatus) (count int64, err error)

GetNotificationCount returns the notification count for user

func GetReleaseAttachments added in v1.1.0

func GetReleaseAttachments(ctx context.Context, rels ...*Release) (err error)

GetReleaseAttachments retrieves the attachments for releases

func GetReleaseCountByRepoID added in v1.2.0

func GetReleaseCountByRepoID(repoID int64, opts FindReleasesOptions) (int64, error)

GetReleaseCountByRepoID returns the count of releases of repository

func GetRepositoryFromMatch added in v1.9.0

func GetRepositoryFromMatch(ownerName, repoName string) (*repo_model.Repository, error)

GetRepositoryFromMatch returns a *repo_model.Repository from a username and repo strings

func GetYamlFixturesAccess added in v1.12.0

func GetYamlFixturesAccess() (string, error)

GetYamlFixturesAccess returns a string containing the contents for the access table, as recalculated using repo.RecalculateAccesses()

func HasFinishedMigratingTask added in v1.17.0

func HasFinishedMigratingTask(repoID int64) (bool, error)

HasFinishedMigratingTask returns if a finished migration task exists for the repo.

func HasRepository added in v1.17.0

func HasRepository(t *organization.Team, repoID int64) bool

HasRepository returns true if given repository belong to team.

func InsertIssueComments added in v1.9.0

func InsertIssueComments(comments []*issues_model.Comment) error

InsertIssueComments inserts many comments of issues.

func InsertIssues added in v1.9.0

func InsertIssues(issues ...*issues_model.Issue) error

InsertIssues insert issues to database

func InsertMilestones added in v1.9.0

func InsertMilestones(ms ...*issues_model.Milestone) (err error)

InsertMilestones creates milestones of repository.

func InsertPullRequests added in v1.9.0

func InsertPullRequests(prs ...*issues_model.PullRequest) error

InsertPullRequests inserted pull requests

func InsertReleases added in v1.9.0

func InsertReleases(rels ...*Release) error

InsertReleases migrates release

func IsErrAccessTokenEmpty

func IsErrAccessTokenEmpty(err error) bool

IsErrAccessTokenEmpty checks if an error is a ErrAccessTokenEmpty.

func IsErrAccessTokenNotExist

func IsErrAccessTokenNotExist(err error) bool

IsErrAccessTokenNotExist checks if an error is a ErrAccessTokenNotExist.

func IsErrBranchAlreadyExists added in v1.3.0

func IsErrBranchAlreadyExists(err error) bool

IsErrBranchAlreadyExists checks if an error is an ErrBranchAlreadyExists.

func IsErrBranchDoesNotExist added in v1.13.0

func IsErrBranchDoesNotExist(err error) bool

IsErrBranchDoesNotExist checks if an error is an ErrBranchDoesNotExist.

func IsErrBranchNameConflict added in v1.3.0

func IsErrBranchNameConflict(err error) bool

IsErrBranchNameConflict checks if an error is an ErrBranchNameConflict.

func IsErrBranchesEqual added in v1.11.0

func IsErrBranchesEqual(err error) bool

IsErrBranchesEqual checks if an error is an ErrBranchesEqual.

func IsErrCommitIDDoesNotMatch added in v1.9.0

func IsErrCommitIDDoesNotMatch(err error) bool

IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.

func IsErrDisallowedToMerge added in v1.17.0

func IsErrDisallowedToMerge(err error) bool

IsErrDisallowedToMerge checks if an error is an ErrDisallowedToMerge.

func IsErrFilePathInvalid added in v1.9.0

func IsErrFilePathInvalid(err error) bool

IsErrFilePathInvalid checks if an error is an ErrFilePathInvalid.

func IsErrFilePathProtected added in v1.12.0

func IsErrFilePathProtected(err error) bool

IsErrFilePathProtected checks if an error is an ErrFilePathProtected.

func IsErrFilenameInvalid added in v1.9.0

func IsErrFilenameInvalid(err error) bool

IsErrFilenameInvalid checks if an error is an ErrFilenameInvalid.

func IsErrForkAlreadyExist added in v1.9.0

func IsErrForkAlreadyExist(err error) bool

IsErrForkAlreadyExist checks if an error is an ErrForkAlreadyExist.

func IsErrInvalidCloneAddr

func IsErrInvalidCloneAddr(err error) bool

IsErrInvalidCloneAddr checks if an error is a ErrInvalidCloneAddr.

func IsErrInvalidMergeStyle added in v1.4.0

func IsErrInvalidMergeStyle(err error) bool

IsErrInvalidMergeStyle checks if an error is a ErrInvalidMergeStyle.

func IsErrInvalidTagName

func IsErrInvalidTagName(err error) bool

IsErrInvalidTagName checks if an error is a ErrInvalidTagName.

func IsErrMergeConflicts added in v1.11.0

func IsErrMergeConflicts(err error) bool

IsErrMergeConflicts checks if an error is a ErrMergeConflicts.

func IsErrMergeUnrelatedHistories added in v1.11.0

func IsErrMergeUnrelatedHistories(err error) bool

IsErrMergeUnrelatedHistories checks if an error is a ErrMergeUnrelatedHistories.

func IsErrNoPendingTransfer added in v1.14.0

func IsErrNoPendingTransfer(err error) bool

IsErrNoPendingTransfer is an error type when a repository has no pending transfers

func IsErrProtectedTagName added in v1.15.0

func IsErrProtectedTagName(err error) bool

IsErrProtectedTagName checks if an error is a ErrProtectedTagName.

func IsErrPullRequestHasMerged added in v1.11.0

func IsErrPullRequestHasMerged(err error) bool

IsErrPullRequestHasMerged checks if an error is a ErrPullRequestHasMerged.

func IsErrRebaseConflicts added in v1.11.0

func IsErrRebaseConflicts(err error) bool

IsErrRebaseConflicts checks if an error is a ErrRebaseConflicts.

func IsErrReleaseAlreadyExist

func IsErrReleaseAlreadyExist(err error) bool

IsErrReleaseAlreadyExist checks if an error is a ErrReleaseAlreadyExist.

func IsErrReleaseNotExist

func IsErrReleaseNotExist(err error) bool

IsErrReleaseNotExist checks if an error is a ErrReleaseNotExist.

func IsErrRepoFileAlreadyExists added in v1.9.0

func IsErrRepoFileAlreadyExists(err error) bool

IsErrRepoFileAlreadyExists checks if an error is a ErrRepoFileAlreadyExists.

func IsErrRepoFileDoesNotExist added in v1.9.0

func IsErrRepoFileDoesNotExist(err error) bool

IsErrRepoFileDoesNotExist checks if an error is a ErrRepoDoesNotExist.

func IsErrRepoTransferInProgress added in v1.14.0

func IsErrRepoTransferInProgress(err error) bool

IsErrRepoTransferInProgress checks if an error is a ErrRepoTransferInProgress.

func IsErrSHADoesNotMatch added in v1.9.0

func IsErrSHADoesNotMatch(err error) bool

IsErrSHADoesNotMatch checks if an error is a ErrSHADoesNotMatch.

func IsErrSHANotFound added in v1.9.0

func IsErrSHANotFound(err error) bool

IsErrSHANotFound checks if an error is a ErrSHANotFound.

func IsErrSHAOrCommitIDNotProvided added in v1.9.0

func IsErrSHAOrCommitIDNotProvided(err error) bool

IsErrSHAOrCommitIDNotProvided checks if an error is a ErrSHAOrCommitIDNotProvided.

func IsErrStopwatchNotExist added in v1.3.0

func IsErrStopwatchNotExist(err error) bool

IsErrStopwatchNotExist checks if an error is a ErrStopwatchNotExist.

func IsErrTagAlreadyExists added in v1.3.0

func IsErrTagAlreadyExists(err error) bool

IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.

func IsErrTaskDoesNotExist added in v1.10.0

func IsErrTaskDoesNotExist(err error) bool

IsErrTaskDoesNotExist checks if an error is a ErrTaskIsNotExist.

func IsErrTrackedTimeNotExist added in v1.3.0

func IsErrTrackedTimeNotExist(err error) bool

IsErrTrackedTimeNotExist checks if an error is a ErrTrackedTimeNotExist.

func IsErrUpdateTaskNotExist

func IsErrUpdateTaskNotExist(err error) bool

IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.

func IsErrUploadNotExist

func IsErrUploadNotExist(err error) bool

IsErrUploadNotExist checks if an error is a ErrUploadNotExist.

func IsErrUserCannotCommit added in v1.9.0

func IsErrUserCannotCommit(err error) bool

IsErrUserCannotCommit checks if an error is an ErrUserCannotCommit.

func IsErrUserHasOrgs

func IsErrUserHasOrgs(err error) bool

IsErrUserHasOrgs checks if an error is a ErrUserHasOrgs.

func IsErrUserOwnPackages added in v1.17.0

func IsErrUserOwnPackages(err error) bool

IsErrUserOwnPackages checks if an error is an ErrUserOwnPackages.

func IsErrUserOwnRepos

func IsErrUserOwnRepos(err error) bool

IsErrUserOwnRepos checks if an error is a ErrUserOwnRepos.

func IsErrWikiAlreadyExist

func IsErrWikiAlreadyExist(err error) bool

IsErrWikiAlreadyExist checks if an error is an ErrWikiAlreadyExist.

func IsErrWikiInvalidFileName added in v1.4.0

func IsErrWikiInvalidFileName(err error) bool

IsErrWikiInvalidFileName checks if an error is an ErrWikiInvalidFileName.

func IsErrWikiReservedName added in v1.4.0

func IsErrWikiReservedName(err error) bool

IsErrWikiReservedName checks if an error is an ErrWikiReservedName.

func IsReleaseExist

func IsReleaseExist(ctx context.Context, repoID int64, tagName string) (bool, error)

IsReleaseExist returns true if release with given tag name already exists.

func NewAccessToken

func NewAccessToken(t *AccessToken) error

NewAccessToken creates new access token.

func NewRepoContext

func NewRepoContext()

NewRepoContext creates a new repository context

func NewTeam

func NewTeam(t *organization.Team) (err error)

NewTeam creates a record of new team. It's caller's responsibility to assign organization ID.

func NotifyWatchers

func NotifyWatchers(actions ...*Action) error

NotifyWatchers creates batch of actions for every watcher.

func NotifyWatchersActions added in v1.11.0

func NotifyWatchersActions(acts []*Action) error

NotifyWatchersActions creates batch of actions for every watcher.

func PushUpdateDeleteTag added in v1.10.0

func PushUpdateDeleteTag(repo *repo_model.Repository, tagName string) error

PushUpdateDeleteTag must be called for any push actions to delete tag

func PushUpdateDeleteTagsContext added in v1.12.0

func PushUpdateDeleteTagsContext(ctx context.Context, repo *repo_model.Repository, tags []string) error

PushUpdateDeleteTagsContext updates a number of delete tags with context

func RemoveAllRepositories added in v1.17.0

func RemoveAllRepositories(t *organization.Team) (err error)

RemoveAllRepositories removes all repositories from team and recalculates access

func RemoveOrgUser

func RemoveOrgUser(orgID, userID int64) error

RemoveOrgUser removes user from given organization.

func RemoveRepository added in v1.17.0

func RemoveRepository(t *organization.Team, repoID int64) error

RemoveRepository removes repository from team of organization. If the team shall include all repositories the request is ignored.

func RemoveTeamMember

func RemoveTeamMember(team *organization.Team, userID int64) error

RemoveTeamMember removes member from given team of given organization.

func SaveOrUpdateTag added in v1.12.0

func SaveOrUpdateTag(repo *repo_model.Repository, newRel *Release) error

SaveOrUpdateTag must be called for any push actions to add tag

func SetIssueReadBy added in v1.17.0

func SetIssueReadBy(ctx context.Context, issueID, userID int64) error

SetIssueReadBy sets issue to be read by given user.

func SetRepoReadBy added in v1.16.0

func SetRepoReadBy(ctx context.Context, userID, repoID int64) error

SetRepoReadBy sets repo to be visited by given user.

func SortReleases

func SortReleases(rels []*Release)

SortReleases sorts releases by number of commits and created time.

func StatsCorrectSQL added in v1.16.0

func StatsCorrectSQL(ctx context.Context, sql string, id int64) error

func TestRepositoryReadyForTransfer added in v1.14.0

func TestRepositoryReadyForTransfer(status repo_model.RepositoryStatus) error

TestRepositoryReadyForTransfer make sure repo is ready to transfer

func TransferOwnership

func TransferOwnership(doer *user_model.User, newOwnerName string, repo *repo_model.Repository) (err error)

TransferOwnership transfers all corresponding repository items from old user to new one.

func UpdateAccessToken

func UpdateAccessToken(t *AccessToken) error

UpdateAccessToken updates information of access token.

func UpdateMigrationsByType added in v1.10.0

func UpdateMigrationsByType(tp structs.GitServiceType, externalUserID string, userID int64) error

UpdateMigrationsByType updates all migrated repositories' posterid from gitServiceType to replace originalAuthorID to posterID

func UpdateNotificationStatuses added in v1.4.0

func UpdateNotificationStatuses(user *user_model.User, currentStatus, desiredStatus NotificationStatus) error

UpdateNotificationStatuses updates the statuses of all of a user's notifications that are of the currentStatus type to the desiredStatus

func UpdateRelease

func UpdateRelease(ctx context.Context, rel *Release) error

UpdateRelease updates all columns of a release

func UpdateReleasesMigrationsByType added in v1.10.0

func UpdateReleasesMigrationsByType(gitServiceType structs.GitServiceType, originalAuthorID string, posterID int64) error

UpdateReleasesMigrationsByType updates all migrated repositories' releases from gitServiceType to replace originalAuthorID to posterID

func UpdateRepoStats added in v1.16.0

func UpdateRepoStats(ctx context.Context, id int64) error

func UpdateTeam

func UpdateTeam(t *organization.Team, authChanged, includeAllChanged bool) (err error)

UpdateTeam updates information of team.

func UploadLocalPath

func UploadLocalPath(uuid string) string

UploadLocalPath returns where uploads is stored in local file system based on given UUID.

Types

type AccessToken

type AccessToken struct {
	ID             int64 `xorm:"pk autoincr"`
	UID            int64 `xorm:"INDEX"`
	Name           string
	Token          string `xorm:"-"`
	TokenHash      string `xorm:"UNIQUE"` // sha256 of token
	TokenSalt      string
	TokenLastEight string `xorm:"token_last_eight"`

	CreatedUnix       timeutil.TimeStamp `xorm:"INDEX created"`
	UpdatedUnix       timeutil.TimeStamp `xorm:"INDEX updated"`
	HasRecentActivity bool               `xorm:"-"`
	HasUsed           bool               `xorm:"-"`
}

AccessToken represents a personal access token.

func GetAccessTokenBySHA

func GetAccessTokenBySHA(token string) (*AccessToken, error)

GetAccessTokenBySHA returns access token by given token value

func ListAccessTokens

func ListAccessTokens(opts ListAccessTokensOptions) ([]*AccessToken, error)

ListAccessTokens returns a list of access tokens belongs to given user.

func (*AccessToken) AfterLoad added in v1.3.0

func (t *AccessToken) AfterLoad()

AfterLoad is invoked from XORM after setting the values of all fields of this object.

type Action

type Action struct {
	ID          int64 `xorm:"pk autoincr"`
	UserID      int64 // Receiver user id.
	OpType      ActionType
	ActUserID   int64            // Action user id.
	ActUser     *user_model.User `xorm:"-"`
	RepoID      int64
	Repo        *repo_model.Repository `xorm:"-"`
	CommentID   int64                  `xorm:"INDEX"`
	Comment     *issues_model.Comment  `xorm:"-"`
	IsDeleted   bool                   `xorm:"NOT NULL DEFAULT false"`
	RefName     string
	IsPrivate   bool               `xorm:"NOT NULL DEFAULT false"`
	Content     string             `xorm:"TEXT"`
	CreatedUnix timeutil.TimeStamp `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) GetActFullName added in v1.6.0

func (a *Action) GetActFullName() string

GetActFullName gets the action's user full name.

func (*Action) GetActUserName

func (a *Action) GetActUserName() string

GetActUserName gets the action's user name.

func (*Action) GetBranch

func (a *Action) GetBranch() string

GetBranch returns the action's repository branch.

func (a *Action) GetCommentLink() string

GetCommentLink returns link to action comment.

func (*Action) GetContent

func (a *Action) GetContent() string

GetContent returns the action's content.

func (*Action) GetCreate

func (a *Action) GetCreate() time.Time

GetCreate returns the action creation time.

func (*Action) GetDisplayName added in v1.9.0

func (a *Action) GetDisplayName() string

GetDisplayName gets the action's display name based on DEFAULT_SHOW_FULL_NAME, or falls back to the username if it is blank.

func (*Action) GetDisplayNameTitle added in v1.9.0

func (a *Action) GetDisplayNameTitle() string

GetDisplayNameTitle gets the action's display name used for the title (tooltip) based on DEFAULT_SHOW_FULL_NAME

func (*Action) GetIssueContent

func (a *Action) GetIssueContent() string

GetIssueContent returns the content of first issue associated with this action.

func (*Action) GetIssueInfos

func (a *Action) GetIssueInfos() []string

GetIssueInfos returns a list of issues associated with the action.

func (*Action) GetIssueTitle

func (a *Action) GetIssueTitle() string

GetIssueTitle returns the title of first issue associated with the action.

func (*Action) GetOpType

func (a *Action) GetOpType() ActionType

GetOpType gets the ActionType of this action.

func (a *Action) GetRefLink() string

GetRefLink returns the action's ref link.

func (a *Action) GetRepoLink() string

GetRepoLink returns relative link to action repository.

func (*Action) GetRepoName

func (a *Action) GetRepoName() string

GetRepoName returns the name of the action repository.

func (*Action) GetRepoPath

func (a *Action) GetRepoPath() string

GetRepoPath returns the virtual path to the action repository.

func (*Action) GetRepoUserName

func (a *Action) GetRepoUserName() string

GetRepoUserName returns the name of the action repository owner.

func (*Action) GetTag added in v1.14.0

func (a *Action) GetTag() string

GetTag returns the action's repository tag.

func (*Action) LoadActUser added in v1.14.0

func (a *Action) LoadActUser()

LoadActUser loads a.ActUser

func (*Action) ShortActUserName

func (a *Action) ShortActUserName() string

ShortActUserName gets the action's user name trimmed to max 20 chars.

func (*Action) ShortRepoName

func (a *Action) ShortRepoName() string

ShortRepoName returns the name of the action repository trimmed to max 33 chars.

func (*Action) ShortRepoPath

func (a *Action) ShortRepoPath() string

ShortRepoPath returns the virtual path to the action repository trimmed to max 20 + 1 + 33 chars.

func (*Action) ShortRepoUserName

func (a *Action) ShortRepoUserName() string

ShortRepoUserName returns the name of the action repository owner trimmed to max 20 chars.

func (*Action) TableIndices added in v1.17.0

func (a *Action) TableIndices() []*schemas.Index

TableIndices implements xorm's TableIndices interface

type ActionList added in v1.4.0

type ActionList []*Action

ActionList defines a list of actions

func GetFeeds

func GetFeeds(ctx context.Context, opts GetFeedsOptions) (ActionList, error)

GetFeeds returns actions according to the provided options

type ActionType

type ActionType int

ActionType represents the type of an action.

const (
	ActionCreateRepo                ActionType = iota + 1 // 1
	ActionRenameRepo                                      // 2
	ActionStarRepo                                        // 3
	ActionWatchRepo                                       // 4
	ActionCommitRepo                                      // 5
	ActionCreateIssue                                     // 6
	ActionCreatePullRequest                               // 7
	ActionTransferRepo                                    // 8
	ActionPushTag                                         // 9
	ActionCommentIssue                                    // 10
	ActionMergePullRequest                                // 11
	ActionCloseIssue                                      // 12
	ActionReopenIssue                                     // 13
	ActionClosePullRequest                                // 14
	ActionReopenPullRequest                               // 15
	ActionDeleteTag                                       // 16
	ActionDeleteBranch                                    // 17
	ActionMirrorSyncPush                                  // 18
	ActionMirrorSyncCreate                                // 19
	ActionMirrorSyncDelete                                // 20
	ActionApprovePullRequest                              // 21
	ActionRejectPullRequest                               // 22
	ActionCommentPull                                     // 23
	ActionPublishRelease                                  // 24
	ActionPullReviewDismissed                             // 25
	ActionPullRequestReadyForReview                       // 26
)

Possible action types.

type ActivityAuthorData added in v1.9.0

type ActivityAuthorData struct {
	Name       string `json:"name"`
	Login      string `json:"login"`
	AvatarLink string `json:"avatar_link"`
	HomeLink   string `json:"home_link"`
	Commits    int64  `json:"commits"`
}

ActivityAuthorData represents statistical git commit count data

func GetActivityStatsTopAuthors added in v1.9.0

func GetActivityStatsTopAuthors(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, count int) ([]*ActivityAuthorData, error)

GetActivityStatsTopAuthors returns top author stats for git commits for all branches

type ActivityStats added in v1.3.0

type ActivityStats struct {
	OpenedPRs                   issues_model.PullRequestList
	OpenedPRAuthorCount         int64
	MergedPRs                   issues_model.PullRequestList
	MergedPRAuthorCount         int64
	OpenedIssues                issues_model.IssueList
	OpenedIssueAuthorCount      int64
	ClosedIssues                issues_model.IssueList
	ClosedIssueAuthorCount      int64
	UnresolvedIssues            issues_model.IssueList
	PublishedReleases           []*Release
	PublishedReleaseAuthorCount int64
	Code                        *git.CodeActivityStats
}

ActivityStats represets issue and pull request information.

func GetActivityStats added in v1.3.0

func GetActivityStats(ctx context.Context, repo *repo_model.Repository, timeFrom time.Time, releases, issues, prs, code bool) (*ActivityStats, error)

GetActivityStats return stats for repository at given time range

func (*ActivityStats) ActiveIssueCount added in v1.3.0

func (stats *ActivityStats) ActiveIssueCount() int

ActiveIssueCount returns total active issue count

func (*ActivityStats) ActivePRCount added in v1.3.0

func (stats *ActivityStats) ActivePRCount() int

ActivePRCount returns total active pull request count

func (*ActivityStats) ClosedIssueCount added in v1.3.0

func (stats *ActivityStats) ClosedIssueCount() int

ClosedIssueCount returns closed issue count

func (*ActivityStats) ClosedIssuePerc added in v1.3.0

func (stats *ActivityStats) ClosedIssuePerc() int

ClosedIssuePerc returns closed issue count percent from total active

func (*ActivityStats) FillIssues added in v1.3.0

func (stats *ActivityStats) FillIssues(repoID int64, fromTime time.Time) error

FillIssues returns issue information for activity page

func (*ActivityStats) FillPullRequests added in v1.3.0

func (stats *ActivityStats) FillPullRequests(repoID int64, fromTime time.Time) error

FillPullRequests returns pull request information for activity page

func (*ActivityStats) FillReleases added in v1.3.0

func (stats *ActivityStats) FillReleases(repoID int64, fromTime time.Time) error

FillReleases returns release information for activity page

func (*ActivityStats) FillUnresolvedIssues added in v1.3.0

func (stats *ActivityStats) FillUnresolvedIssues(repoID int64, fromTime time.Time, issues, prs bool) error

FillUnresolvedIssues returns unresolved issue and pull request information for activity page

func (*ActivityStats) MergedPRCount added in v1.3.0

func (stats *ActivityStats) MergedPRCount() int

MergedPRCount returns merged pull request count

func (*ActivityStats) MergedPRPerc added in v1.3.0

func (stats *ActivityStats) MergedPRPerc() int

MergedPRPerc returns merged pull request percent from total active

func (*ActivityStats) OpenedIssueCount added in v1.3.0

func (stats *ActivityStats) OpenedIssueCount() int

OpenedIssueCount returns open issue count

func (*ActivityStats) OpenedIssuePerc added in v1.3.0

func (stats *ActivityStats) OpenedIssuePerc() int

OpenedIssuePerc returns open issue count percent from total active

func (*ActivityStats) OpenedPRCount added in v1.3.0

func (stats *ActivityStats) OpenedPRCount() int

OpenedPRCount returns opened pull request count

func (*ActivityStats) OpenedPRPerc added in v1.3.0

func (stats *ActivityStats) OpenedPRPerc() int

OpenedPRPerc returns opened pull request percents from total active

func (*ActivityStats) PublishedReleaseCount added in v1.3.0

func (stats *ActivityStats) PublishedReleaseCount() int

PublishedReleaseCount returns published release count

func (*ActivityStats) UnresolvedIssueCount added in v1.3.0

func (stats *ActivityStats) UnresolvedIssueCount() int

UnresolvedIssueCount returns unresolved issue and pull request count

type CreateRepoOptions

type CreateRepoOptions struct {
	Name           string
	Description    string
	OriginalURL    string
	GitServiceType api.GitServiceType
	Gitignores     string
	IssueLabels    string
	License        string
	Readme         string
	DefaultBranch  string
	IsPrivate      bool
	IsMirror       bool
	IsTemplate     bool
	AutoInit       bool
	Status         repo_model.RepositoryStatus
	TrustModel     repo_model.TrustModelType
	MirrorInterval string
}

CreateRepoOptions contains the create repository options

type ErrAccessTokenEmpty

type ErrAccessTokenEmpty struct{}

ErrAccessTokenEmpty represents a "AccessTokenEmpty" kind of error.

func (ErrAccessTokenEmpty) Error

func (err ErrAccessTokenEmpty) Error() string

type ErrAccessTokenNotExist

type ErrAccessTokenNotExist struct {
	Token string
}

ErrAccessTokenNotExist represents a "AccessTokenNotExist" kind of error.

func (ErrAccessTokenNotExist) Error

func (err ErrAccessTokenNotExist) Error() string

type ErrBranchAlreadyExists added in v1.3.0

type ErrBranchAlreadyExists struct {
	BranchName string
}

ErrBranchAlreadyExists represents an error that branch with such name already exists.

func (ErrBranchAlreadyExists) Error added in v1.3.0

func (err ErrBranchAlreadyExists) Error() string

type ErrBranchDoesNotExist added in v1.13.0

type ErrBranchDoesNotExist struct {
	BranchName string
}

ErrBranchDoesNotExist represents an error that branch with such name does not exist.

func (ErrBranchDoesNotExist) Error added in v1.13.0

func (err ErrBranchDoesNotExist) Error() string

type ErrBranchNameConflict added in v1.3.0

type ErrBranchNameConflict struct {
	BranchName string
}

ErrBranchNameConflict represents an error that branch name conflicts with other branch.

func (ErrBranchNameConflict) Error added in v1.3.0

func (err ErrBranchNameConflict) Error() string

type ErrBranchesEqual added in v1.11.0

type ErrBranchesEqual struct {
	BaseBranchName string
	HeadBranchName string
}

ErrBranchesEqual represents an error that branch name conflicts with other branch.

func (ErrBranchesEqual) Error added in v1.11.0

func (err ErrBranchesEqual) Error() string

type ErrCommitIDDoesNotMatch added in v1.9.0

type ErrCommitIDDoesNotMatch struct {
	GivenCommitID   string
	CurrentCommitID string
}

ErrCommitIDDoesNotMatch represents a "CommitIDDoesNotMatch" kind of error.

func (ErrCommitIDDoesNotMatch) Error added in v1.9.0

func (err ErrCommitIDDoesNotMatch) Error() string

type ErrDisallowedToMerge added in v1.17.0

type ErrDisallowedToMerge struct {
	Reason string
}

ErrDisallowedToMerge represents an error that a branch is protected and the current user is not allowed to modify it.

func (ErrDisallowedToMerge) Error added in v1.17.0

func (err ErrDisallowedToMerge) Error() string

type ErrFilePathInvalid added in v1.9.0

type ErrFilePathInvalid struct {
	Message string
	Path    string
	Name    string
	Type    git.EntryMode
}

ErrFilePathInvalid represents a "FilePathInvalid" kind of error.

func (ErrFilePathInvalid) Error added in v1.9.0

func (err ErrFilePathInvalid) Error() string

type ErrFilePathProtected added in v1.12.0

type ErrFilePathProtected struct {
	Message string
	Path    string
}

ErrFilePathProtected represents a "FilePathProtected" kind of error.

func (ErrFilePathProtected) Error added in v1.12.0

func (err ErrFilePathProtected) Error() string

type ErrFilenameInvalid added in v1.9.0

type ErrFilenameInvalid struct {
	Path string
}

ErrFilenameInvalid represents a "FilenameInvalid" kind of error.

func (ErrFilenameInvalid) Error added in v1.9.0

func (err ErrFilenameInvalid) Error() string

type ErrForkAlreadyExist added in v1.9.0

type ErrForkAlreadyExist struct {
	Uname    string
	RepoName string
	ForkName string
}

ErrForkAlreadyExist represents a "ForkAlreadyExist" kind of error.

func (ErrForkAlreadyExist) Error added in v1.9.0

func (err ErrForkAlreadyExist) Error() string

type ErrInvalidCloneAddr

type ErrInvalidCloneAddr struct {
	Host               string
	IsURLError         bool
	IsInvalidPath      bool
	IsProtocolInvalid  bool
	IsPermissionDenied bool
	LocalPath          bool
}

ErrInvalidCloneAddr represents a "InvalidCloneAddr" kind of error.

func (*ErrInvalidCloneAddr) Error

func (err *ErrInvalidCloneAddr) Error() string

type ErrInvalidMergeStyle added in v1.4.0

type ErrInvalidMergeStyle struct {
	ID    int64
	Style repo_model.MergeStyle
}

ErrInvalidMergeStyle represents an error if merging with disabled merge strategy

func (ErrInvalidMergeStyle) Error added in v1.4.0

func (err ErrInvalidMergeStyle) Error() string

type ErrInvalidTagName

type ErrInvalidTagName struct {
	TagName string
}

ErrInvalidTagName represents a "InvalidTagName" kind of error.

func (ErrInvalidTagName) Error

func (err ErrInvalidTagName) Error() string

type ErrMergeConflicts added in v1.11.0

type ErrMergeConflicts struct {
	Style  repo_model.MergeStyle
	StdOut string
	StdErr string
	Err    error
}

ErrMergeConflicts represents an error if merging fails with a conflict

func (ErrMergeConflicts) Error added in v1.11.0

func (err ErrMergeConflicts) Error() string

type ErrMergeUnrelatedHistories added in v1.11.0

type ErrMergeUnrelatedHistories struct {
	Style  repo_model.MergeStyle
	StdOut string
	StdErr string
	Err    error
}

ErrMergeUnrelatedHistories represents an error if merging fails due to unrelated histories

func (ErrMergeUnrelatedHistories) Error added in v1.11.0

func (err ErrMergeUnrelatedHistories) Error() string

type ErrNoPendingRepoTransfer added in v1.14.0

type ErrNoPendingRepoTransfer struct {
	RepoID int64
}

ErrNoPendingRepoTransfer is an error type for repositories without a pending transfer request

func (ErrNoPendingRepoTransfer) Error added in v1.14.0

func (e ErrNoPendingRepoTransfer) Error() string

type ErrProtectedTagName added in v1.15.0

type ErrProtectedTagName struct {
	TagName string
}

ErrProtectedTagName represents a "ProtectedTagName" kind of error.

func (ErrProtectedTagName) Error added in v1.15.0

func (err ErrProtectedTagName) Error() string

type ErrPullRequestHasMerged added in v1.11.0

type ErrPullRequestHasMerged struct {
	ID         int64
	IssueID    int64
	HeadRepoID int64
	BaseRepoID int64
	HeadBranch string
	BaseBranch string
}

ErrPullRequestHasMerged represents a "PullRequestHasMerged"-error

func (ErrPullRequestHasMerged) Error added in v1.11.0

func (err ErrPullRequestHasMerged) Error() string

Error does pretty-printing :D

type ErrRebaseConflicts added in v1.11.0

type ErrRebaseConflicts struct {
	Style     repo_model.MergeStyle
	CommitSHA string
	StdOut    string
	StdErr    string
	Err       error
}

ErrRebaseConflicts represents an error if rebase fails with a conflict

func (ErrRebaseConflicts) Error added in v1.11.0

func (err ErrRebaseConflicts) Error() string

type ErrReleaseAlreadyExist

type ErrReleaseAlreadyExist struct {
	TagName string
}

ErrReleaseAlreadyExist represents a "ReleaseAlreadyExist" kind of error.

func (ErrReleaseAlreadyExist) Error

func (err ErrReleaseAlreadyExist) Error() string

type ErrReleaseNotExist

type ErrReleaseNotExist struct {
	ID      int64
	TagName string
}

ErrReleaseNotExist represents a "ReleaseNotExist" kind of error.

func (ErrReleaseNotExist) Error

func (err ErrReleaseNotExist) Error() string

type ErrRepoFileAlreadyExists added in v1.9.0

type ErrRepoFileAlreadyExists struct {
	Path string
}

ErrRepoFileAlreadyExists represents a "RepoFileAlreadyExist" kind of error.

func (ErrRepoFileAlreadyExists) Error added in v1.9.0

func (err ErrRepoFileAlreadyExists) Error() string

type ErrRepoFileDoesNotExist added in v1.9.0

type ErrRepoFileDoesNotExist struct {
	Path string
	Name string
}

ErrRepoFileDoesNotExist represents a "RepoFileDoesNotExist" kind of error.

func (ErrRepoFileDoesNotExist) Error added in v1.9.0

func (err ErrRepoFileDoesNotExist) Error() string

type ErrRepoTransferInProgress added in v1.14.0

type ErrRepoTransferInProgress struct {
	Uname string
	Name  string
}

ErrRepoTransferInProgress represents the state of a repository that has an ongoing transfer

func (ErrRepoTransferInProgress) Error added in v1.14.0

func (err ErrRepoTransferInProgress) Error() string

type ErrSHADoesNotMatch added in v1.9.0

type ErrSHADoesNotMatch struct {
	Path       string
	GivenSHA   string
	CurrentSHA string
}

ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.

func (ErrSHADoesNotMatch) Error added in v1.9.0

func (err ErrSHADoesNotMatch) Error() string

type ErrSHANotFound added in v1.9.0

type ErrSHANotFound struct {
	SHA string
}

ErrSHANotFound represents a "SHADoesNotMatch" kind of error.

func (ErrSHANotFound) Error added in v1.9.0

func (err ErrSHANotFound) Error() string

type ErrSHAOrCommitIDNotProvided added in v1.9.0

type ErrSHAOrCommitIDNotProvided struct{}

ErrSHAOrCommitIDNotProvided represents a "SHAOrCommitIDNotProvided" kind of error.

func (ErrSHAOrCommitIDNotProvided) Error added in v1.9.0

func (err ErrSHAOrCommitIDNotProvided) Error() string

type ErrStopwatchNotExist added in v1.3.0

type ErrStopwatchNotExist struct {
	ID int64
}

ErrStopwatchNotExist represents a "Stopwatch Not Exist" kind of error.

func (ErrStopwatchNotExist) Error added in v1.3.0

func (err ErrStopwatchNotExist) Error() string

type ErrTagAlreadyExists added in v1.3.0

type ErrTagAlreadyExists struct {
	TagName string
}

ErrTagAlreadyExists represents an error that tag with such name already exists.

func (ErrTagAlreadyExists) Error added in v1.3.0

func (err ErrTagAlreadyExists) Error() string

type ErrTaskDoesNotExist added in v1.10.0

type ErrTaskDoesNotExist struct {
	ID     int64
	RepoID int64
	Type   structs.TaskType
}

ErrTaskDoesNotExist represents a "TaskDoesNotExist" kind of error.

func (ErrTaskDoesNotExist) Error added in v1.10.0

func (err ErrTaskDoesNotExist) Error() string

type ErrTrackedTimeNotExist added in v1.3.0

type ErrTrackedTimeNotExist struct {
	ID int64
}

ErrTrackedTimeNotExist represents a "TrackedTime Not Exist" kind of error.

func (ErrTrackedTimeNotExist) Error added in v1.3.0

func (err ErrTrackedTimeNotExist) Error() string

type ErrUpdateTaskNotExist

type ErrUpdateTaskNotExist struct {
	UUID string
}

ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.

func (ErrUpdateTaskNotExist) Error

func (err ErrUpdateTaskNotExist) Error() string

type ErrUploadNotExist

type ErrUploadNotExist struct {
	ID   int64
	UUID string
}

ErrUploadNotExist represents a "UploadNotExist" kind of error.

func (ErrUploadNotExist) Error

func (err ErrUploadNotExist) Error() string

type ErrUserCannotCommit added in v1.9.0

type ErrUserCannotCommit struct {
	UserName string
}

ErrUserCannotCommit represents "UserCannotCommit" kind of error.

func (ErrUserCannotCommit) Error added in v1.9.0

func (err ErrUserCannotCommit) Error() string

type ErrUserHasOrgs

type ErrUserHasOrgs struct {
	UID int64
}

ErrUserHasOrgs represents a "UserHasOrgs" kind of error.

func (ErrUserHasOrgs) Error

func (err ErrUserHasOrgs) Error() string

type ErrUserOwnPackages added in v1.17.0

type ErrUserOwnPackages struct {
	UID int64
}

ErrUserOwnPackages notifies that the user (still) owns the packages.

func (ErrUserOwnPackages) Error added in v1.17.0

func (err ErrUserOwnPackages) Error() string

type ErrUserOwnRepos

type ErrUserOwnRepos struct {
	UID int64
}

ErrUserOwnRepos represents a "UserOwnRepos" kind of error.

func (ErrUserOwnRepos) Error

func (err ErrUserOwnRepos) Error() string

type ErrWikiAlreadyExist

type ErrWikiAlreadyExist struct {
	Title string
}

ErrWikiAlreadyExist represents a "WikiAlreadyExist" kind of error.

func (ErrWikiAlreadyExist) Error

func (err ErrWikiAlreadyExist) Error() string

type ErrWikiInvalidFileName added in v1.4.0

type ErrWikiInvalidFileName struct {
	FileName string
}

ErrWikiInvalidFileName represents an invalid wiki file name.

func (ErrWikiInvalidFileName) Error added in v1.4.0

func (err ErrWikiInvalidFileName) Error() string

type ErrWikiReservedName added in v1.4.0

type ErrWikiReservedName struct {
	Title string
}

ErrWikiReservedName represents a reserved name error.

func (ErrWikiReservedName) Error added in v1.4.0

func (err ErrWikiReservedName) Error() string

type FindNotificationOptions added in v1.12.0

type FindNotificationOptions struct {
	db.ListOptions
	UserID            int64
	RepoID            int64
	IssueID           int64
	Status            []NotificationStatus
	Source            []NotificationSource
	UpdatedAfterUnix  int64
	UpdatedBeforeUnix int64
}

FindNotificationOptions represent the filters for notifications. If an ID is 0 it will be ignored.

func (*FindNotificationOptions) ToCond added in v1.12.0

func (opts *FindNotificationOptions) ToCond() builder.Cond

ToCond will convert each condition into a xorm-Cond

func (*FindNotificationOptions) ToSession added in v1.12.0

func (opts *FindNotificationOptions) ToSession(ctx context.Context) *xorm.Session

ToSession will convert the given options to a xorm Session by using the conditions from ToCond and joining with issue table if required

type FindReleasesOptions added in v1.2.0

type FindReleasesOptions struct {
	db.ListOptions
	IncludeDrafts bool
	IncludeTags   bool
	IsPreRelease  util.OptionalBool
	IsDraft       util.OptionalBool
	TagNames      []string
}

FindReleasesOptions describes the conditions to Find releases

type FindTaskOptions added in v1.10.0

type FindTaskOptions struct {
	Status int
}

FindTaskOptions find all tasks

func (FindTaskOptions) ToConds added in v1.10.0

func (opts FindTaskOptions) ToConds() builder.Cond

ToConds generates conditions for database operation.

type GetFeedsOptions added in v1.2.0

type GetFeedsOptions struct {
	db.ListOptions
	RequestedUser   *user_model.User       // the user we want activity for
	RequestedTeam   *organization.Team     // the team we want activity for
	RequestedRepo   *repo_model.Repository // the repo we want activity for
	Actor           *user_model.User       // the user viewing the activity
	IncludePrivate  bool                   // include private actions
	OnlyPerformedBy bool                   // only actions performed by requested user
	IncludeDeleted  bool                   // include deleted actions
	Date            string                 // the day we want activity for: YYYY-MM-DD
}

GetFeedsOptions options for retrieving feeds

type IssueByLabelCount added in v1.16.0

type IssueByLabelCount struct {
	Count int64
	Label string
}

IssueByLabelCount contains the number of issue group by label

type IssueByRepositoryCount added in v1.16.0

type IssueByRepositoryCount struct {
	Count      int64
	OwnerName  string
	Repository string
}

IssueByRepositoryCount contains the number of issue group by repository

type ListAccessTokensOptions added in v1.13.0

type ListAccessTokensOptions struct {
	db.ListOptions
	Name   string
	UserID int64
}

ListAccessTokensOptions contain filter options

type MinimalOrg added in v1.15.0

type MinimalOrg = organization.Organization

MinimalOrg represents a simple orgnization with only needed columns

func GetUserOrgsList added in v1.15.0

func GetUserOrgsList(user *user_model.User) ([]*MinimalOrg, error)

GetUserOrgsList returns one user's all orgs list

type Notification added in v1.1.0

type Notification struct {
	ID     int64 `xorm:"pk autoincr"`
	UserID int64 `xorm:"INDEX NOT NULL"`
	RepoID int64 `xorm:"INDEX NOT NULL"`

	Status NotificationStatus `xorm:"SMALLINT INDEX NOT NULL"`
	Source NotificationSource `xorm:"SMALLINT INDEX NOT NULL"`

	IssueID   int64  `xorm:"INDEX NOT NULL"`
	CommitID  string `xorm:"INDEX"`
	CommentID int64

	UpdatedBy int64 `xorm:"INDEX NOT NULL"`

	Issue      *issues_model.Issue    `xorm:"-"`
	Repository *repo_model.Repository `xorm:"-"`
	Comment    *issues_model.Comment  `xorm:"-"`
	User       *user_model.User       `xorm:"-"`

	CreatedUnix timeutil.TimeStamp `xorm:"created INDEX NOT NULL"`
	UpdatedUnix timeutil.TimeStamp `xorm:"updated INDEX NOT NULL"`
}

Notification represents a notification

func GetNotificationByID added in v1.12.0

func GetNotificationByID(notificationID int64) (*Notification, error)

GetNotificationByID return notification by ID

func SetNotificationStatus added in v1.1.0

func SetNotificationStatus(notificationID int64, user *user_model.User, status NotificationStatus) (*Notification, error)

SetNotificationStatus change the notification status

func (*Notification) APIURL added in v1.12.0

func (n *Notification) APIURL() string

APIURL formats a URL-string to the notification

func (*Notification) GetIssue added in v1.1.0

func (n *Notification) GetIssue() (*issues_model.Issue, error)

GetIssue returns the issue of the notification

func (*Notification) GetRepo added in v1.1.0

func (n *Notification) GetRepo() (*repo_model.Repository, error)

GetRepo returns the repo of the notification

func (*Notification) HTMLURL added in v1.11.0

func (n *Notification) HTMLURL() string

HTMLURL formats a URL-string to the notification

func (*Notification) LoadAttributes added in v1.12.0

func (n *Notification) LoadAttributes() (err error)

LoadAttributes load Repo Issue User and Comment if not loaded

type NotificationList added in v1.11.0

type NotificationList []*Notification

NotificationList contains a list of notifications

func GetNotifications added in v1.12.0

func GetNotifications(ctx context.Context, options *FindNotificationOptions) (nl NotificationList, err error)

GetNotifications returns all notifications that fit to the given options.

func NotificationsForUser added in v1.1.0

func NotificationsForUser(ctx context.Context, user *user_model.User, statuses []NotificationStatus, page, perPage int) (notifications NotificationList, err error)

NotificationsForUser returns notifications for a given user and status

func (NotificationList) LoadAttributes added in v1.12.0

func (nl NotificationList) LoadAttributes() error

LoadAttributes load Repo Issue User and Comment if not loaded

func (NotificationList) LoadComments added in v1.11.0

func (nl NotificationList) LoadComments() ([]int, error)

LoadComments loads comments from database

func (NotificationList) LoadIssues added in v1.11.0

func (nl NotificationList) LoadIssues() ([]int, error)

LoadIssues loads issues from database

func (NotificationList) LoadRepos added in v1.11.0

func (nl NotificationList) LoadRepos() (repo_model.RepositoryList, []int, error)

LoadRepos loads repositories from database

func (NotificationList) Without added in v1.11.4

func (nl NotificationList) Without(failures []int) NotificationList

Without returns the notification list without the failures

type NotificationSource added in v1.1.0

type NotificationSource uint8

NotificationSource is the source of the notification (issue, PR, commit, etc)

const (
	// NotificationSourceIssue is a notification of an issue
	NotificationSourceIssue NotificationSource = iota + 1
	// NotificationSourcePullRequest is a notification of a pull request
	NotificationSourcePullRequest
	// NotificationSourceCommit is a notification of a commit
	NotificationSourceCommit
	// NotificationSourceRepository is a notification for a repository
	NotificationSourceRepository
)

type NotificationStatus added in v1.1.0

type NotificationStatus uint8

NotificationStatus is the status of the notification (read or unread)

const (
	// NotificationStatusUnread represents an unread notification
	NotificationStatusUnread NotificationStatus = iota + 1
	// NotificationStatusRead represents a read notification
	NotificationStatusRead
	// NotificationStatusPinned represents a pinned notification
	NotificationStatusPinned
)

type Release

type Release struct {
	ID               int64                  `xorm:"pk autoincr"`
	RepoID           int64                  `xorm:"INDEX UNIQUE(n)"`
	Repo             *repo_model.Repository `xorm:"-"`
	PublisherID      int64                  `xorm:"INDEX"`
	Publisher        *user_model.User       `xorm:"-"`
	TagName          string                 `xorm:"INDEX UNIQUE(n)"`
	OriginalAuthor   string
	OriginalAuthorID int64 `xorm:"index"`
	LowerTagName     string
	Target           string
	Title            string
	Sha1             string `xorm:"VARCHAR(40)"`
	NumCommits       int64
	NumCommitsBehind int64                    `xorm:"-"`
	Note             string                   `xorm:"TEXT"`
	RenderedNote     string                   `xorm:"-"`
	IsDraft          bool                     `xorm:"NOT NULL DEFAULT false"`
	IsPrerelease     bool                     `xorm:"NOT NULL DEFAULT false"`
	IsTag            bool                     `xorm:"NOT NULL DEFAULT false"`
	Attachments      []*repo_model.Attachment `xorm:"-"`
	CreatedUnix      timeutil.TimeStamp       `xorm:"INDEX"`
}

Release represents a release of repository.

func GetLatestReleaseByRepoID added in v1.12.0

func GetLatestReleaseByRepoID(repoID int64) (*Release, error)

GetLatestReleaseByRepoID returns the latest release for a repository

func GetRelease

func GetRelease(repoID int64, tagName string) (*Release, error)

GetRelease returns release by given ID.

func GetReleaseByID

func GetReleaseByID(ctx context.Context, id int64) (*Release, error)

GetReleaseByID returns release with given ID.

func GetReleasesByRepoID

func GetReleasesByRepoID(repoID int64, opts FindReleasesOptions) ([]*Release, error)

GetReleasesByRepoID returns a list of releases of repository.

func GetReleasesByRepoIDAndNames added in v1.1.0

func GetReleasesByRepoIDAndNames(ctx context.Context, repoID int64, tagNames []string) (rels []*Release, err error)

GetReleasesByRepoIDAndNames returns a list of releases of repository according repoID and tagNames.

func (*Release) APIURL added in v1.1.0

func (r *Release) APIURL() string

APIURL the api url for a release. release must have attributes loaded

func (*Release) GetExternalID added in v1.17.0

func (r *Release) GetExternalID() int64

ExternalID ExternalUserRemappable interface

func (*Release) GetExternalName added in v1.17.0

func (r *Release) GetExternalName() string

ExternalName ExternalUserRemappable interface

func (*Release) GetUserID added in v1.17.0

func (r *Release) GetUserID() int64

UserID ExternalUserRemappable interface

func (*Release) HTMLURL added in v1.12.0

func (r *Release) HTMLURL() string

HTMLURL the url for a release on the web UI. release must have attributes loaded

func (*Release) LoadAttributes added in v1.1.0

func (r *Release) LoadAttributes() error

LoadAttributes load repo and publisher attributes for a release

func (*Release) RemapExternalUser added in v1.17.0

func (r *Release) RemapExternalUser(externalName string, externalID, userID int64) error

RemapExternalUser ExternalUserRemappable interface

func (*Release) TarURL added in v1.1.0

func (r *Release) TarURL() string

TarURL the tar.gz url for a release. release must have attributes loaded

func (*Release) ZipURL added in v1.1.0

func (r *Release) ZipURL() string

ZipURL the zip url for a release. release must have attributes loaded

type RepoTransfer added in v1.14.0

type RepoTransfer struct {
	ID          int64 `xorm:"pk autoincr"`
	DoerID      int64
	Doer        *user_model.User `xorm:"-"`
	RecipientID int64
	Recipient   *user_model.User `xorm:"-"`
	RepoID      int64
	TeamIDs     []int64
	Teams       []*organization.Team `xorm:"-"`

	CreatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL created"`
	UpdatedUnix timeutil.TimeStamp `xorm:"INDEX NOT NULL updated"`
}

RepoTransfer is used to manage repository transfers

func GetPendingRepositoryTransfer added in v1.14.0

func GetPendingRepositoryTransfer(repo *repo_model.Repository) (*RepoTransfer, error)

GetPendingRepositoryTransfer fetches the most recent and ongoing transfer process for the repository

func (*RepoTransfer) CanUserAcceptTransfer added in v1.14.0

func (r *RepoTransfer) CanUserAcceptTransfer(u *user_model.User) bool

CanUserAcceptTransfer checks if the user has the rights to accept/decline a repo transfer. For user, it checks if it's himself For organizations, it checks if the user is able to create repos

func (*RepoTransfer) LoadAttributes added in v1.14.0

func (r *RepoTransfer) LoadAttributes() error

LoadAttributes fetches the transfer recipient from the database

type Statistic

type Statistic struct {
	Counter struct {
		User, Org, PublicKey,
		Repo, Watch, Star, Action, Access,
		Issue, IssueClosed, IssueOpen,
		Comment, Oauth, Follow,
		Mirror, Release, AuthSource, Webhook,
		Milestone, Label, HookTask,
		Team, UpdateTask, Project,
		ProjectBoard, Attachment int64
		IssueByLabel      []IssueByLabelCount
		IssueByRepository []IssueByRepositoryCount
	}
}

Statistic contains the database statistics

func GetStatistic

func GetStatistic() (stats Statistic)

GetStatistic returns the database statistics

type Task added in v1.10.0

type Task struct {
	ID             int64
	DoerID         int64                  `xorm:"index"` // operator
	Doer           *user_model.User       `xorm:"-"`
	OwnerID        int64                  `xorm:"index"` // repo owner id, when creating, the repoID maybe zero
	Owner          *user_model.User       `xorm:"-"`
	RepoID         int64                  `xorm:"index"`
	Repo           *repo_model.Repository `xorm:"-"`
	Type           structs.TaskType
	Status         structs.TaskStatus `xorm:"index"`
	StartTime      timeutil.TimeStamp
	EndTime        timeutil.TimeStamp
	PayloadContent string             `xorm:"TEXT"`
	Message        string             `xorm:"TEXT"` // if task failed, saved the error reason
	Created        timeutil.TimeStamp `xorm:"created"`
}

Task represents a task

func FindTasks added in v1.10.0

func FindTasks(opts FindTaskOptions) ([]*Task, error)

FindTasks find all tasks

func GetMigratingTask added in v1.10.0

func GetMigratingTask(repoID int64) (*Task, error)

GetMigratingTask returns the migrating task by repo's id

func GetMigratingTaskByID added in v1.13.0

func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, error)

GetMigratingTaskByID returns the migrating task by repo's id

func (*Task) LoadDoer added in v1.10.0

func (task *Task) LoadDoer() error

LoadDoer loads do user

func (*Task) LoadOwner added in v1.10.0

func (task *Task) LoadOwner() error

LoadOwner loads owner user

func (*Task) LoadRepo added in v1.10.0

func (task *Task) LoadRepo() error

LoadRepo loads repository of the task

func (*Task) MigrateConfig added in v1.10.0

func (task *Task) MigrateConfig() (*migration.MigrateOptions, error)

MigrateConfig returns task config when migrate repository

func (*Task) UpdateCols added in v1.10.0

func (task *Task) UpdateCols(cols ...string) error

UpdateCols updates some columns

type TranslatableMessage added in v1.15.0

type TranslatableMessage struct {
	Format string
	Args   []interface{} `json:"omitempty"`
}

TranslatableMessage represents JSON struct that can be translated with a Locale

type Upload

type Upload struct {
	ID   int64  `xorm:"pk autoincr"`
	UUID string `xorm:"uuid UNIQUE"`
	Name string
}

Upload represent a uploaded file to a repo to be deleted when moved

func GetUploadByUUID

func GetUploadByUUID(uuid string) (*Upload, error)

GetUploadByUUID returns the Upload by UUID

func GetUploadsByUUIDs

func GetUploadsByUUIDs(uuids []string) ([]*Upload, error)

GetUploadsByUUIDs returns multiple uploads by UUIDS

func NewUpload

func NewUpload(name string, buf []byte, file multipart.File) (_ *Upload, err error)

NewUpload creates a new upload object.

func (*Upload) LocalPath

func (upload *Upload) LocalPath() string

LocalPath returns where uploads are temporarily stored in local file system.

type UserHeatmapData added in v1.7.0

type UserHeatmapData struct {
	Timestamp     timeutil.TimeStamp `json:"timestamp"`
	Contributions int64              `json:"contributions"`
}

UserHeatmapData represents the data needed to create a heatmap

func GetUserHeatmapDataByUser added in v1.7.0

func GetUserHeatmapDataByUser(user, doer *user_model.User) ([]*UserHeatmapData, error)

GetUserHeatmapDataByUser returns an array of UserHeatmapData

func GetUserHeatmapDataByUserTeam added in v1.14.0

func GetUserHeatmapDataByUserTeam(user *user_model.User, team *organization.Team, doer *user_model.User) ([]*UserHeatmapData, error)

GetUserHeatmapDataByUserTeam returns an array of UserHeatmapData

type UserIDCount added in v1.12.0

type UserIDCount struct {
	UserID int64
	Count  int64
}

UserIDCount is a simple coalition of UserID and Count

func GetUIDsAndNotificationCounts added in v1.12.0

func GetUIDsAndNotificationCounts(since, until timeutil.TimeStamp) ([]UserIDCount, error)

GetUIDsAndNotificationCounts between the two provided times

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL