Fix task save query
This commit is contained in:
parent
db21c27b54
commit
7fc7b1889b
13
db/task.go
13
db/task.go
@ -2,8 +2,6 @@ package db
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/fatih/structs"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
@ -26,7 +24,16 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (t *Task) Save() {
|
func (t *Task) Save() {
|
||||||
if _, err := stmt(saveTaskQuery).Exec(structs.Values(t)); err != nil {
|
if _, err := stmt(saveTaskQuery).Exec(
|
||||||
|
t.Token, t.Owner,
|
||||||
|
t.Job, t.Worker,
|
||||||
|
t.Duration, t.Error,
|
||||||
|
t.CreatedAt, t.StartedAt,
|
||||||
|
); err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (t *Task) T() *Task {
|
||||||
|
return t
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user