|
1 | 1 | //! Insert Unstaked TXO Native Assets into the DB.
|
2 | 2 |
|
3 |
| -use std::sync::Arc; |
| 3 | +use std::{fmt, sync::Arc}; |
4 | 4 |
|
5 | 5 | use cardano_blockchain_types::{Slot, TransactionId, TxnIndex, TxnOutputOffset};
|
6 | 6 | use scylla::{SerializeRow, Session};
|
7 | 7 | use tracing::error;
|
8 | 8 |
|
9 | 9 | use crate::{
|
10 | 10 | db::{
|
11 |
| - index::queries::{PreparedQueries, SizedBatch}, |
| 11 | + index::queries::{PreparedQueries, Query, QueryKind, SizedBatch}, |
12 | 12 | types::{DbSlot, DbTransactionId, DbTxnIndex, DbTxnOutputOffset},
|
13 | 13 | },
|
14 | 14 | settings::cassandra_db,
|
@@ -37,6 +37,22 @@ pub(crate) struct Params {
|
37 | 37 | value: num_bigint::BigInt,
|
38 | 38 | }
|
39 | 39 |
|
| 40 | +impl fmt::Display for Params { |
| 41 | + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { |
| 42 | + write!(f, "{INSERT_UNSTAKED_TXO_ASSET_QUERY}") |
| 43 | + } |
| 44 | +} |
| 45 | + |
| 46 | +impl Query for Params { |
| 47 | + async fn prepare_query( |
| 48 | + session: &Arc<Session>, cfg: &cassandra_db::EnvVars, |
| 49 | + ) -> anyhow::Result<crate::db::index::queries::QueryKind> { |
| 50 | + Params::prepare_batch(session, cfg) |
| 51 | + .await |
| 52 | + .map(QueryKind::Batch) |
| 53 | + } |
| 54 | +} |
| 55 | + |
40 | 56 | impl Params {
|
41 | 57 | /// Create a new record for this transaction.
|
42 | 58 | ///
|
|
0 commit comments