// TxUpdate is the same as Update except it allows you to specify your own transaction
172740
func (s *Store) TxUpdate(tx *bolt.Tx, key interface{}, data interface{}) error {
	if !tx.Writable() {
		return bolt.ErrTxNotWritable
	}

	storer := newStorer(data)

	gk, err := encode(key)

	if err != nil {
		return err
	}

	b, err := tx.CreateBucketIfNotExists([]byte(storer.Type()))
	if err != nil {
		return err
	}

	existing := b.Get(gk)

	if existing == nil {
		return ErrNotFound
	}

	// delete any existing indexes
	existingVal := reflect.New(reflect.TypeOf(data)).Interface()

	err = decode(existing, existingVal)
	if err != nil {
		return err
	}

	err = indexDelete(storer, tx, gk, existingVal)
	if err != nil {
		return err
	}

	value, err := encode(data)
	if err != nil {
		return err
	}

	// put data
	err = b.Put(gk, value)
	if err != nil {
		return err
	}

	// insert any new indexes
	return indexAdd(storer, tx, gk, data)
}
418548
func UpdateConfig(tx Tx, c *api.Config) error {
	// Ensure the name is either not in use or already used by this same Config.
	if existing := tx.lookup(tableConfig, indexName, strings.ToLower(c.Spec.Annotations.Name)); existing != nil {
		if existing.GetID() != c.ID {
			return ErrNameConflict
		}
	}

	return tx.update(tableConfig, c)
}
637026
func Update(id string, params *stripe.DisputeParams) (*stripe.Dispute, error) {
	return getC().Update(id, params)
}
541729
func Update(id string, params *stripe.OrderUpdateParams) (*stripe.Order, error) {
	return getC().Update(id, params)
}
71939
func (tx *Tx) UpdateBySql(query string, value ...interface{}) *UpdateStmt {
	b := UpdateBySql(query, value...)
	b.runner = tx
	b.EventReceiver = tx.EventReceiver
	b.Dialect = tx.Dialect
	return b
}
373463
func (h *Handle) Update(ctx sessionctx.Context) error {
	var priv MySQLPrivilege
	err := priv.LoadAll(ctx)
	if err != nil {
		return errors.Trace(err)
	}

	h.priv.Store(&priv)
	return nil
}
1018822
func (a *AddressOutpoints) Update(txns []*TxWithBlockData,
	outpoints []*wire.OutPoint, prevOutpoint []PrevOut) {
	// Relevant outpoints
	a.Outpoints = append(a.Outpoints, outpoints...)

	// Previous outpoints (inputs)
	a.PrevOuts = append(a.PrevOuts, prevOutpoint...)

	// Referenced transactions
	for _, t := range txns {
		a.TxnsStore[t.Hash()] = t
	}
}
75078
func (t *DatacentersTable) update(c context.Context) error {
	// Avoid using the database connection to prepare unnecessary statements.
	if len(t.updates) == 0 {
		return nil
	}

	db := database.Get(c)
	stmt, err := db.PrepareContext(c, `
		UPDATE datacenters
		SET description = ?, state = ?
		WHERE id = ?
	`)
	if err != nil {
		return errors.Annotate(err, "failed to prepare statement").Err()
	}
	defer stmt.Close()

	// Update each datacenter in the table. It's more efficient to update the slice of
	// datacenters once at the end rather than for each update, so use a defer.
	updated := make(map[int64]*Datacenter, len(t.updates))
	defer func() {
		for _, dc := range t.current {
			if u, ok := updated[dc.Id]; ok {
				dc.Description = u.Description
				dc.State = u.State
			}
		}
	}()
	for len(t.updates) > 0 {
		dc := t.updates[0]
		if _, err := stmt.ExecContext(c, dc.Description, dc.State, dc.Id); err != nil {
			return errors.Annotate(err, "failed to update datacenter %q", dc.Name).Err()
		}
		updated[dc.Id] = dc
		t.updates = t.updates[1:]
		logging.Infof(c, "Updated datacenter %q", dc.Name)
	}
	return nil
}
985068
func (cli *Client) NodeUpdate(ctx context.Context, nodeID string, version swarm.Version, node swarm.NodeSpec) error {
	query := url.Values{}
	query.Set("version", strconv.FormatUint(version.Index, 10))
	resp, err := cli.post(ctx, "/nodes/"+nodeID+"/update", query, node, nil)
	ensureReaderClosed(resp)
	return err
}
399409
func (r *Env) Update(op lmdb.TxnOp) error {
	return r.runHandler(false, func() error { return r.Env.Update(op) }, r.Handlers)
}
1091632
func Update(id string, params *stripe.PlanParams) (*stripe.Plan, error) {
	return getC().Update(id, params)
}
414959
func (r ResourceEventHandlerFuncs) OnUpdate(oldObj, newObj interface{}) {
	if r.UpdateFunc != nil {
		r.UpdateFunc(oldObj, newObj)
	}
}
1229216
func (tx *Tx) Update(table string) *UpdateStmt {
	b := Update(table)
	b.runner = tx
	b.EventReceiver = tx.EventReceiver
	b.Dialect = tx.Dialect
	return b
}
1135684
func (o *Object) Update() {
	o.mut.Lock()
	o.checked = false
	o.mut.Unlock()
}
410613
func (c *Client) ClientUpdate(properties ...CmdArg) error {
	_, err := c.ExecCmd(NewCmd("clientupdate").WithArgs(properties...))
	return err
}
523534
func (af *avgFunction) StreamUpdate(row []types.Datum, ctx context.Context) error {
	return af.streamUpdateSum(row, ctx)
}
359081
func (m *ClientDB) CommitUpdate(id *wtdb.SessionID, seqNum uint16,
	update *wtdb.CommittedUpdate) (uint16, error) {

	m.mu.Lock()
	defer m.mu.Unlock()

	// Fail if session doesn't exist.
	session, ok := m.activeSessions[*id]
	if !ok {
		return 0, wtdb.ErrClientSessionNotFound
	}

	// Check if an update has already been committed for this state.
	dbUpdate, ok := session.CommittedUpdates[seqNum]
	if ok {
		// If the breach hint matches, we'll just return the last
		// applied value so the client can retransmit.
		if dbUpdate.Hint == update.Hint {
			return session.TowerLastApplied, nil
		}

		// Otherwise, fail since the breach hint doesn't match.
		return 0, wtdb.ErrUpdateAlreadyCommitted
	}

	// Sequence number must increment.
	if seqNum != session.SeqNum+1 {
		return 0, wtdb.ErrCommitUnorderedUpdate
	}

	// Save the update and increment the sequence number.
	session.CommittedUpdates[seqNum] = update
	session.SeqNum++

	return session.TowerLastApplied, nil
}