MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / NewTask

Function NewTask

cmd/cql-proxy/model/task.go:164–183  ·  view source on GitHub ↗

NewTask creates new task and save in database.

(db *gorp.DbMap, tt TaskType, developer int64, account int64, args gin.H)

Source from the content-addressed store, hash-verified

162
163// NewTask creates new task and save in database.
164func NewTask(db *gorp.DbMap, tt TaskType, developer int64, account int64, args gin.H) (t *Task, err error) {
165 now := time.Now().Unix()
166 t = &Task{
167 Type: tt,
168 Developer: developer,
169 Account: account,
170 State: TaskWaiting,
171 Args: args,
172 Result: nil,
173 Created: now,
174 Updated: now,
175 }
176
177 err = db.Insert(t)
178 if err != nil {
179 err = errors.Wrapf(err, "new task failed")
180 }
181
182 return
183}
184
185// GetTask returns task with specified id and developer.
186func GetTask(db *gorp.DbMap, developer int64, id int64) (t *Task, err error) {

Callers 1

NewMethod · 0.92

Calls 1

InsertMethod · 0.80

Tested by

no test coverage detected