// Update implements Aggregation interface.
760044
func (cf *countFunction) Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) error {
	var datumBuf []types.Datum
	if cf.HasDistinct {
		datumBuf = make([]types.Datum, 0, len(cf.Args))
	}
	for _, a := range cf.Args {
		value, err := a.Eval(row)
		if err != nil {
			return err
		}
		if value.IsNull() {
			return nil
		}
		if cf.Mode == FinalMode || cf.Mode == Partial2Mode {
			evalCtx.Count += value.GetInt64()
		}
		if cf.HasDistinct {
			datumBuf = append(datumBuf, value)
		}
	}
	if cf.HasDistinct {
		d, err := evalCtx.DistinctChecker.Check(datumBuf)
		if err != nil {
			return err
		}
		if !d {
			return nil
		}
	}
	if cf.Mode == CompleteMode || cf.Mode == Partial1Mode {
		evalCtx.Count++
	}
	return nil
}
95388
func (me *Dataset) Update(i interface{}) *CrudExec {
	sql, args, err := me.ToUpdateSql(i)
	return newCrudExec(me.database, err, sql, args...)
}
410246
func (s *awsService) Update(ctx context.Context, group Elastigroup) error {
	input := &aws.UpdateGroupInput{
		Group: group.Obj().(*aws.Group),
	}

	_, err := s.svc.Update(ctx, input)
	return err

}
219140
func (s *UserStorage) Update(c model.User) error {
	_, exists := s.users[c.ID]
	if !exists {
		return fmt.Errorf("User with id %s does not exist", c.ID)
	}
	s.users[c.ID] = &c

	return nil
}
1212928
func (r *GroupService) Update(appId string, id string, group *Group) *GroupUpdateCall {
	c := &GroupUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
	c.appId = appId
	c.id = id
	c.group = group
	return c
}
1303523
func (agp *AuthGroupPermission) Update(db XODB) error {
	var err error

	// if doesn't exist, bail
	if !agp._exists {
		return errors.New("update failed: does not exist")
	}

	// if deleted, bail
	if agp._deleted {
		return errors.New("update failed: marked for deletion")
	}

	// sql query
	const sqlstr = `UPDATE auth_group_permissions SET ` +
		`group_id = ?, permission_id = ?` +
		` WHERE id = ?`

	// run query
	XOLog(sqlstr, agp.GroupID, agp.PermissionID, agp.ID)
	_, err = db.Exec(sqlstr, agp.GroupID, agp.PermissionID, agp.ID)
	return err
}
103393
func (builder *Builder) Update(collection string, changes map[string]interface{}, cond c.Condition) (string, []interface{}) {
	length := len(changes)

	var buffer bytes.Buffer
	var args = make([]interface{}, 0, length)

	buffer.WriteString("UPDATE ")
	buffer.WriteString(builder.config.EscapeChar)
	buffer.WriteString(collection)
	buffer.WriteString(builder.config.EscapeChar)
	buffer.WriteString(" SET ")

	curr := 0
	for field, value := range changes {
		buffer.WriteString(builder.config.EscapeChar)
		buffer.WriteString(field)
		buffer.WriteString(builder.config.EscapeChar)
		buffer.WriteString("=")
		buffer.WriteString(builder.ph())
		args = append(args, value)

		if curr < length-1 {
			buffer.WriteString(",")
		}

		curr++
	}

	if s, arg := builder.where(cond); s != "" {
		buffer.WriteString(" ")
		buffer.WriteString(s)
		args = append(args, arg...)
	}

	buffer.WriteString(";")

	return buffer.String(), args
}
722236
func (m *Mercury) Update(ctx context.Context, key, val string, opts ...clientv3.OpOption) (*clientv3.TxnResponse, error) {
	return m.BatchUpdate(ctx, map[string]string{key: val}, opts...)
}
627856
func (c *groups) Update(group *user.Group) (result *user.Group, err error) {
	result = &user.Group{}
	err = c.client.Put().
		Resource("groups").
		Name(group.Name).
		Body(group).
		Do().
		Into(result)
	return
}
539208
func (aug *AuthUserGroup) Update(db XODB) error {
	var err error

	// if doesn't exist, bail
	if !aug._exists {
		return errors.New("update failed: does not exist")
	}

	// if deleted, bail
	if aug._deleted {
		return errors.New("update failed: marked for deletion")
	}

	// sql query
	const sqlstr = `UPDATE public.auth_user_groups SET (` +
		`user_id, group_id` +
		`) = ( ` +
		`$1, $2` +
		`) WHERE id = $3`

	// run query
	XOLog(sqlstr, aug.UserID, aug.GroupID, aug.ID)
	_, err = db.Exec(sqlstr, aug.UserID, aug.GroupID, aug.ID)
	return err
}
790653
func (g *Gauge) Update(value int64) {
	g.gauge.Update(float64(value))
}
869297
func (af *avgFunction) Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) (err error) {
	switch af.Mode {
	case Partial1Mode, CompleteMode:
		err = af.updateSum(sc, evalCtx, row)
	case Partial2Mode, FinalMode:
		err = af.updateAvg(sc, evalCtx, row)
	case DedupMode:
		panic("DedupMode is not supported now.")
	}
	return err
}
896770
func (b *Builder) Update(updates ...Eq) *Builder {
	b.updates = updates
	b.optype = updateType
	return b
}
587662
func (s *Snapshotter) Update(ctx context.Context, info snapshots.Info, fieldpaths ...string) (snapshots.Info, error) {
	log.G(ctx).Debugf("update: %s", strings.Join(fieldpaths, ", "))

	var err error
	err = s.withTransaction(ctx, true, func(ctx context.Context) error {
		info, err = storage.UpdateInfo(ctx, info, fieldpaths...)
		return err
	})

	return info, err
}
422811
func (charts *ChartData) Update() {
	for _, updater := range charts.updaters {
		stateID := charts.StateID()
		rows, cancel, err := updater.Fetcher(charts)
		if err != nil {
			err = fmt.Errorf("error encountered during charts %s update. aborting update: %v", updater.Tag, err)
		} else {
			charts.mtx.Lock()
			if !charts.validState(stateID) {
				err = fmt.Errorf("state change detected during charts %s update. aborting update", updater.Tag)
			} else {
				err = updater.Appender(charts, rows)
				if err != nil {
					err = fmt.Errorf("error detected during charts %s append. aborting update: %v", updater.Tag, err)
				}
			}
			charts.mtx.Unlock()
		}
		cancel()
		if err != nil {
			log.Warnf("%v", err)
			return
		}
	}
}
1229216
func (tx *Tx) Update(table string) *UpdateStmt {
	b := Update(table)
	b.runner = tx
	b.EventReceiver = tx.EventReceiver
	b.Dialect = tx.Dialect
	return b
}
295226
func (ha *Heap) Update() {
	ha.m.Lock()
	defer ha.m.Unlock()

	runtime.ReadMemStats(&ha.mem)
	ha.g.Update(int64(ha.mem.HeapAlloc))
}