admin

package
v1.21.8 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 12 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateTask added in v1.17.4

func CreateTask(ctx context.Context, task *Task) error

CreateTask creates a task on database

func FinishMigrateTask added in v1.17.4

func FinishMigrateTask(ctx context.Context, task *Task) error

FinishMigrateTask updates database when migrate task finished

func IsErrTaskDoesNotExist added in v1.17.4

func IsErrTaskDoesNotExist(err error) bool

IsErrTaskDoesNotExist checks if an error is a ErrTaskDoesNotExist.

Types

type ErrTaskDoesNotExist added in v1.17.4

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

ErrTaskDoesNotExist represents a "TaskDoesNotExist" kind of error.

func (ErrTaskDoesNotExist) Error added in v1.17.4

func (err ErrTaskDoesNotExist) Error() string

func (ErrTaskDoesNotExist) Unwrap added in v1.17.4

func (err ErrTaskDoesNotExist) Unwrap() error

type Task added in v1.17.4

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, it could be a JSON string of TranslatableMessage or a plain message
	Created        timeutil.TimeStamp `xorm:"created"`
}

Task represents a task

func GetMigratingTask added in v1.17.4

func GetMigratingTask(ctx context.Context, repoID int64) (*Task, error)

GetMigratingTask returns the migrating task by repo's id

func GetMigratingTaskByID added in v1.17.4

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

GetMigratingTaskByID returns the migrating task by repo's id

func (*Task) LoadDoer added in v1.17.4

func (task *Task) LoadDoer(ctx context.Context) error

LoadDoer loads do user

func (*Task) LoadOwner added in v1.17.4

func (task *Task) LoadOwner(ctx context.Context) error

LoadOwner loads owner user

func (*Task) LoadRepo added in v1.17.4

func (task *Task) LoadRepo(ctx context.Context) error

LoadRepo loads repository of the task

func (*Task) MigrateConfig added in v1.17.4

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

MigrateConfig returns task config when migrate repository

func (*Task) UpdateCols added in v1.17.4

func (task *Task) UpdateCols(ctx context.Context, cols ...string) error

UpdateCols updates some columns

type TranslatableMessage added in v1.17.4

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

TranslatableMessage represents JSON struct that can be translated with a Locale

Jump to

Keyboard shortcuts

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