本文整理匯總了Golang中github.com/evergreen-ci/evergreen/db.Update函數的典型用法代碼示例。如果您正苦於以下問題:Golang Update函數的具體用法?Golang Update怎麽用?Golang Update使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了Update函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: UpdateOne
// UpdateOne updates one host.
func UpdateOne(query interface{}, update interface{}) error {
return db.Update(
Collection,
query,
update,
)
}
示例2: DequeueTask
// pull out the task with the specified id from both the in-memory and db
// versions of the task queue
func (self *TaskQueue) DequeueTask(taskId string) error {
// first, remove from the in-memory queue
found := false
for idx, queueItem := range self.Queue {
if queueItem.Id == taskId {
found = true
self.Queue = append(self.Queue[:idx], self.Queue[idx+1:]...)
}
}
// validate that the task is there
if !found {
return fmt.Errorf("task id %v was not present in queue for distro"+
" %v", taskId, self.Distro)
}
return db.Update(
TaskQueuesCollection,
bson.M{
TaskQueueDistroKey: self.Distro,
},
bson.M{
"$pull": bson.M{
TaskQueueQueueKey: bson.M{
TaskQueueItemIdKey: taskId,
},
},
},
)
}
示例3: UpdateOneNotification
func UpdateOneNotification(query interface{}, update interface{}) error {
return db.Update(
NotifyHistoryCollection,
query,
update,
)
}
示例4: UpdateStatus
func (self *PushLog) UpdateStatus(newStatus string) error {
return db.Update(
PushlogCollection,
bson.M{
PushLogIdKey: self.Id,
},
bson.M{
"$set": bson.M{
PushLogStatusKey: newStatus,
},
},
)
}
示例5: UpdateLastRevision
// UpdateLastRevision updates the last created revision of a project.
func UpdateLastRevision(projectId, revision string) error {
return db.Update(
RepositoriesCollection,
bson.M{
RepoProjectKey: projectId,
},
bson.M{
"$set": bson.M{
RepoLastRevisionKey: revision,
},
},
)
}