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

Method GetBalanceByID

balance.go:257–268  ·  view source on GitHub ↗

GetBalanceByID retrieves a balance by its ID. It starts a tracing span, fetches the balance, and records relevant events. Parameters: - ctx context.Context: The context for the operation. - id string: The ID of the balance to retrieve. - include []string: A slice of strings specifying additional da

(ctx context.Context, id string, include []string, withQueued bool)

Source from the content-addressed store, hash-verified

255// - *model.Balance: A pointer to the Balance model if found.
256// - error: An error if the balance could not be retrieved.
257func (l *LedgerForge) GetBalanceByID(ctx context.Context, id string, include []string, withQueued bool) (*model.Balance, error) {
258 _, span := balanceTracer.Start(ctx, "GetBalanceByID")
259 defer span.End()
260
261 balance, err := l.datasource.GetBalanceByID(id, include, withQueued)
262 if err != nil {
263 span.RecordError(err)
264 return nil, err
265 }
266 span.AddEvent("Balance retrieved", trace.WithAttributes(attribute.String("balance.id", id)))
267 return balance, nil
268}
269
270// GetAllBalances retrieves all balances.
271// It starts a tracing span, fetches all balances, and records relevant events.

Callers 3

TestGetBalanceByID_MockFunction · 0.95
UpdateMetadataMethod · 0.95
TestGetBalanceByIDFunction · 0.95

Calls 2

GetBalanceByIDMethod · 0.65
StartMethod · 0.45

Tested by 2

TestGetBalanceByID_MockFunction · 0.76
TestGetBalanceByIDFunction · 0.76