MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / updateAccount

Function updateAccount

blockproducer/storage.go:282–302  ·  view source on GitHub ↗
(account *types.Account)

Source from the content-addressed store, hash-verified

280}
281
282func updateAccount(account *types.Account) storageProcedure {
283 var (
284 enc *bytes.Buffer
285 err error
286 )
287 if enc, err = utils.EncodeMsgPack(account); err != nil {
288 return errPass(err)
289 }
290 return func(tx *sql.Tx) (err error) {
291 log.WithFields(log.Fields{
292 "account_address": account.Address.String(),
293 "account_nonce": account.NextNonce,
294 "account_balances": account.TokenBalance,
295 }).Debug("updating account")
296 _, err = tx.Exec(`INSERT OR REPLACE INTO "accounts" ("address", "encoded")
297 VALUES (?, ?)`,
298 account.Address.String(),
299 enc.Bytes())
300 return
301 }
302}
303
304func deleteAccount(address proto.AccountAddress) storageProcedure {
305 return func(tx *sql.Tx) (err error) {

Callers 1

compileChangesMethod · 0.85

Calls 7

EncodeMsgPackFunction · 0.92
WithFieldsFunction · 0.92
errPassFunction · 0.85
DebugMethod · 0.80
ExecMethod · 0.65
StringMethod · 0.45
BytesMethod · 0.45

Tested by

no test coverage detected