Пример #1
0
// PutTask places the task into the database.
func PutTask(tx *bolt.Tx, task *api.Task) error {
	return withCreateTaskBucketIfNotExists(tx, task.ID, func(bkt *bolt.Bucket) error {
		task = task.Copy()
		task.Status = api.TaskStatus{} // blank out the status.

		p, err := proto.Marshal(task)
		if err != nil {
			return err
		}
		return bkt.Put(bucketKeyData, p)
	})
}