models

package
v1.22.3 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2024 License: MIT Imports: 21 Imported by: 1,618

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAllRepositories added in v1.17.0

func AddAllRepositories(ctx context.Context, t *organization.Team) (err error)

AddAllRepositories adds all repositories to the team

func AddRepository added in v1.17.0

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

func AddTeamMember

func AddTeamMember(ctx context.Context, team *organization.Team, user *user_model.User) error

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

func CheckRepoStats

func CheckRepoStats(ctx context.Context) error

CheckRepoStats checks the repository stats

func CreatePendingRepositoryTransfer added in v1.14.0

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

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

func DeleteDeployKey

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

DeleteDeployKey delete deploy keys

func DeleteRepositoryTransfer added in v1.22.0

func DeleteRepositoryTransfer(ctx context.Context, repoID int64) error

func DeleteTeam

func DeleteTeam(ctx context.Context, t *organization.Team) error

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

func DoctorUserStarNum added in v1.12.2

func DoctorUserStarNum(ctx context.Context) (err error)

DoctorUserStarNum recalculate Stars number for all user

func GetYamlFixturesAccess added in v1.12.0

func GetYamlFixturesAccess(ctx context.Context) (string, error)

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

func Init added in v1.17.4

func Init(ctx context.Context) error

Init initialize model

func IsErrCommitIDDoesNotMatch added in v1.9.0

func IsErrCommitIDDoesNotMatch(err error) bool

IsErrCommitIDDoesNotMatch checks if an error is a ErrCommitIDDoesNotMatch.

func IsErrDeleteLastAdminUser added in v1.21.4

func IsErrDeleteLastAdminUser(err error) bool

IsErrDeleteLastAdminUser checks if an error is a ErrDeleteLastAdminUser.

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 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 IsErrMergeDivergingFastForwardOnly added in v1.22.0

func IsErrMergeDivergingFastForwardOnly(err error) bool

IsErrMergeDivergingFastForwardOnly checks if an error is a ErrMergeDivergingFastForwardOnly.

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 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 IsErrTagAlreadyExists added in v1.3.0

func IsErrTagAlreadyExists(err error) bool

IsErrTagAlreadyExists checks if an error is an ErrTagAlreadyExists.

func IsErrUpdateTaskNotExist

func IsErrUpdateTaskNotExist(err error) bool

IsErrUpdateTaskNotExist checks if an error is a ErrUpdateTaskNotExist.

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 NewTeam

func NewTeam(ctx context.Context, t *organization.Team) (err error)

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

func ReconsiderRepoIssuesAssignee added in v1.21.0

func ReconsiderRepoIssuesAssignee(ctx context.Context, repo *repo_model.Repository, user *user_model.User) error

func ReconsiderWatches added in v1.21.0

func ReconsiderWatches(ctx context.Context, repo *repo_model.Repository, user *user_model.User) error

func RemoveAllRepositories added in v1.17.0

func RemoveAllRepositories(ctx context.Context, t *organization.Team) (err error)

RemoveAllRepositories removes all repositories from team and recalculates access

func RemoveOrgUser

func RemoveOrgUser(ctx context.Context, org *organization.Organization, user *user_model.User) error

RemoveOrgUser removes user from given organization.

func RemoveTeamMember

func RemoveTeamMember(ctx context.Context, team *organization.Team, user *user_model.User) error

RemoveTeamMember removes member from given team of given organization.

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 UpdateRepoStats added in v1.16.0

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

func UpdateTeam

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

UpdateTeam updates information of team.

Types

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 ErrDeleteLastAdminUser added in v1.21.4

type ErrDeleteLastAdminUser struct {
	UID int64
}

ErrDeleteLastAdminUser represents a "DeleteLastAdminUser" kind of error.

func (ErrDeleteLastAdminUser) Error added in v1.21.4

func (err ErrDeleteLastAdminUser) 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

func (ErrDisallowedToMerge) Unwrap added in v1.17.4

func (err ErrDisallowedToMerge) Unwrap() error

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

func (ErrFilePathInvalid) Unwrap added in v1.17.4

func (err ErrFilePathInvalid) Unwrap() error

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

func (ErrFilePathProtected) Unwrap added in v1.17.4

func (err ErrFilePathProtected) Unwrap() error

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

func (ErrFilenameInvalid) Unwrap added in v1.17.4

func (err ErrFilenameInvalid) Unwrap() error

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

func (*ErrInvalidCloneAddr) Unwrap added in v1.17.4

func (err *ErrInvalidCloneAddr) Unwrap() error

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

func (ErrInvalidMergeStyle) Unwrap added in v1.17.4

func (err ErrInvalidMergeStyle) Unwrap() error

type ErrInvalidTagName

type ErrInvalidTagName struct {
	TagName string
}

ErrInvalidTagName represents a "InvalidTagName" kind of error.

func (ErrInvalidTagName) Error

func (err ErrInvalidTagName) Error() string

func (ErrInvalidTagName) Unwrap added in v1.17.4

func (err ErrInvalidTagName) Unwrap() error

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 ErrMergeDivergingFastForwardOnly added in v1.22.0

type ErrMergeDivergingFastForwardOnly struct {
	StdOut string
	StdErr string
	Err    error
}

ErrMergeDivergingFastForwardOnly represents an error if a fast-forward-only merge fails because the branches diverge

func (ErrMergeDivergingFastForwardOnly) Error added in v1.22.0

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 (err ErrNoPendingRepoTransfer) Error() string

func (ErrNoPendingRepoTransfer) Unwrap added in v1.17.4

func (err ErrNoPendingRepoTransfer) Unwrap() error

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

func (ErrProtectedTagName) Unwrap added in v1.17.4

func (err ErrProtectedTagName) Unwrap() error

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

func (ErrRepoFileAlreadyExists) Unwrap added in v1.17.4

func (err ErrRepoFileAlreadyExists) Unwrap() error

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

func (ErrRepoFileDoesNotExist) Unwrap added in v1.17.4

func (err ErrRepoFileDoesNotExist) Unwrap() error

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

func (ErrRepoTransferInProgress) Unwrap added in v1.17.4

func (err ErrRepoTransferInProgress) Unwrap() error

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

func (ErrSHANotFound) Unwrap added in v1.17.4

func (err ErrSHANotFound) Unwrap() error

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

func (ErrTagAlreadyExists) Unwrap added in v1.17.4

func (err ErrTagAlreadyExists) Unwrap() error

type ErrUpdateTaskNotExist

type ErrUpdateTaskNotExist struct {
	UUID string
}

ErrUpdateTaskNotExist represents a "UpdateTaskNotExist" kind of error.

func (ErrUpdateTaskNotExist) Error

func (err ErrUpdateTaskNotExist) Error() string

func (ErrUpdateTaskNotExist) Unwrap added in v1.17.4

func (err ErrUpdateTaskNotExist) Unwrap() error

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

func (ErrUserCannotCommit) Unwrap added in v1.17.4

func (err ErrUserCannotCommit) Unwrap() error

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 PendingRepositoryTransferOptions added in v1.22.0

type PendingRepositoryTransferOptions struct {
	RepoID      int64
	SenderID    int64
	RecipientID int64
}

func (*PendingRepositoryTransferOptions) ToConds added in v1.22.0

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(ctx context.Context, repo *repo_model.Repository) (*RepoTransfer, error)

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

func GetPendingRepositoryTransfers added in v1.22.0

func GetPendingRepositoryTransfers(ctx context.Context, opts *PendingRepositoryTransferOptions) ([]*RepoTransfer, error)

func (*RepoTransfer) CanUserAcceptTransfer added in v1.14.0

func (r *RepoTransfer) CanUserAcceptTransfer(ctx context.Context, 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(ctx context.Context) error

LoadAttributes fetches the transfer recipient from the database

Jump to

Keyboard shortcuts

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