chore(models): rewrite code format. (#14754)
* chore: rewrite format. * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: update format Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com> * chore: Adjacent parameters with the same type should be grouped together * chore: update format.
This commit is contained in:
parent
164e35ead3
commit
167b0f46ef
103 changed files with 474 additions and 460 deletions
|
@ -135,7 +135,7 @@ func (err ErrTaskDoesNotExist) Error() string {
|
|||
|
||||
// GetMigratingTask returns the migrating task by repo's id
|
||||
func GetMigratingTask(repoID int64) (*Task, error) {
|
||||
var task = Task{
|
||||
task := Task{
|
||||
RepoID: repoID,
|
||||
Type: structs.TaskTypeMigrateRepo,
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ func GetMigratingTask(repoID int64) (*Task, error) {
|
|||
|
||||
// GetMigratingTaskByID returns the migrating task by repo's id
|
||||
func GetMigratingTaskByID(id, doerID int64) (*Task, *migration.MigrateOptions, error) {
|
||||
var task = Task{
|
||||
task := Task{
|
||||
ID: id,
|
||||
DoerID: doerID,
|
||||
Type: structs.TaskTypeMigrateRepo,
|
||||
|
@ -177,7 +177,7 @@ type FindTaskOptions struct {
|
|||
|
||||
// ToConds generates conditions for database operation.
|
||||
func (opts FindTaskOptions) ToConds() builder.Cond {
|
||||
var cond = builder.NewCond()
|
||||
cond := builder.NewCond()
|
||||
if opts.Status >= 0 {
|
||||
cond = cond.And(builder.Eq{"status": opts.Status})
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ func (opts FindTaskOptions) ToConds() builder.Cond {
|
|||
|
||||
// FindTasks find all tasks
|
||||
func FindTasks(opts FindTaskOptions) ([]*Task, error) {
|
||||
var tasks = make([]*Task, 0, 10)
|
||||
tasks := make([]*Task, 0, 10)
|
||||
err := x.Where(opts.ToConds()).Find(&tasks)
|
||||
return tasks, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue