| 267 | }; |
| 268 | |
| 269 | static struct channel_event *stmt2channel_event(const tal_t *ctx, struct db_stmt *stmt) |
| 270 | { |
| 271 | struct channel_event *e = tal(ctx, struct channel_event); |
| 272 | |
| 273 | e->db_id = db_col_u64(stmt, "e.id"); |
| 274 | e->acct_db_id = db_col_u64(stmt, "e.account_id"); |
| 275 | e->acct_name = db_col_strdup(e, stmt, "a.name"); |
| 276 | |
| 277 | e->tag = db_col_strdup(e, stmt, "e.tag"); |
| 278 | |
| 279 | e->credit = db_col_amount_msat(stmt, "e.credit"); |
| 280 | e->debit = db_col_amount_msat(stmt, "e.debit"); |
| 281 | e->fees = db_col_amount_msat(stmt, "e.fees"); |
| 282 | |
| 283 | e->currency = db_col_strdup_optional(e, stmt, "e.currency"); |
| 284 | if (!db_col_is_null(stmt, "e.payment_id")) { |
| 285 | e->payment_id = tal(e, struct sha256); |
| 286 | db_col_sha256(stmt, "e.payment_id", e->payment_id); |
| 287 | } else |
| 288 | e->payment_id = NULL; |
| 289 | e->part_id = db_col_int(stmt, "e.part_id"); |
| 290 | e->timestamp = db_col_u64(stmt, "e.timestamp"); |
| 291 | |
| 292 | if (!db_col_is_null(stmt, "e.ev_desc")) |
| 293 | e->desc = db_col_strdup(e, stmt, "e.ev_desc"); |
| 294 | else |
| 295 | e->desc = NULL; |
| 296 | |
| 297 | if (!db_col_is_null(stmt, "e.rebalance_id")) { |
| 298 | e->rebalance_id = tal(e, u64); |
| 299 | *e->rebalance_id = db_col_u64(stmt, "e.rebalance_id"); |
| 300 | } else |
| 301 | e->rebalance_id = NULL; |
| 302 | |
| 303 | return e; |
| 304 | } |
| 305 | |
| 306 | static struct channel_event **list_channel_events(const tal_t *ctx, |
| 307 | struct db *db) |
no test coverage detected