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)
| 255 | // - *model.Balance: A pointer to the Balance model if found. |
| 256 | // - error: An error if the balance could not be retrieved. |
| 257 | func (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. |