} } timer := time.Now() pairs, e := this.plan.Keyspace().Update(pairs) context.AddPhaseTime("update", time.Since(timer)) // Update mutation count with number of updated docs context.AddMutationCount(uint64(len(pairs))) if e != nil { context.Error(e) } for _, item := range this.batch { if !this.sendItem(item) { return false } } return true } func (this *SendUpdate) readonly() bool { return false } var _UPDATE_POOL = datastore.NewPairPool(_BATCH_SIZE)
// Perform the actual UPSERT keys, e := this.plan.Keyspace().Upsert(dpairs) context.AddPhaseTime("upsert", time.Since(timer)) // Update mutation count with number of upserted docs context.AddMutationCount(uint64(len(keys))) if e != nil { context.Error(e) } // Capture the upserted keys in case there is a RETURNING clause for i, k := range keys { av := value.NewAnnotatedValue(make(map[string]interface{})) av.SetAttachment("meta", map[string]interface{}{"id": k}) av.SetField(this.plan.Alias(), dpairs[i].Value) if !this.sendItem(av) { return false } } return true } func (this *SendUpsert) readonly() bool { return false } var _UPSERT_POOL = datastore.NewPairPool(_BATCH_SIZE)