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

Function updateProvider

blockproducer/storage.go:376–395  ·  view source on GitHub ↗
(profile *types.ProviderProfile)

Source from the content-addressed store, hash-verified

374}
375
376func updateProvider(profile *types.ProviderProfile) storageProcedure {
377 var (
378 enc *bytes.Buffer
379 err error
380 )
381 if enc, err = utils.EncodeMsgPack(profile); err != nil {
382 return errPass(err)
383 }
384 return func(tx *sql.Tx) (err error) {
385 log.WithFields(log.Fields{
386 "provider_address": profile.Provider.String(),
387 "provider_token_type": profile.TokenType,
388 "provider_node_id": profile.NodeID,
389 }).Debug("updating provider")
390 _, err = tx.Exec(`INSERT OR REPLACE INTO "provider" ("address", "encoded") VALUES (?, ?)`,
391 profile.Provider.String(),
392 enc.Bytes())
393 return
394 }
395}
396
397func deleteProvider(address proto.AccountAddress) storageProcedure {
398 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