MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / UpdateBalanceMetadata

Method UpdateBalanceMetadata

database/metadata.go:68–80  ·  view source on GitHub ↗

UpdateBalanceMetadata updates the metadata for a specific balance in the database. It marshals the metadata map to JSON before storing it. Parameters: - ctx: The context for the database operation. - id: The ID of the balance to update. - metadata: The new metadata to store. Returns: - error: An e

(ctx context.Context, id string, metadata map[string]interface{})

Source from the content-addressed store, hash-verified

66// Returns:
67// - error: An error if the update operation fails.
68func (d *Datasource) UpdateBalanceMetadata(ctx context.Context, id string, metadata map[string]interface{}) error {
69 metadataJSON, err := json.Marshal(metadata)
70 if err != nil {
71 return err
72 }
73
74 _, err = d.Conn.ExecContext(ctx, `
75 UPDATE ledgerforge.balances
76 SET meta_data = $1
77 WHERE balance_id = $2
78 `, metadataJSON, id)
79 return err
80}
81
82// UpdateIdentityMetadata updates the metadata for a specific identity in the database.
83// It marshals the metadata map to JSON before storing it.

Callers 1

Calls

no outgoing calls

Tested by 1