Skip to content

Commit 11ab25a

Browse files
committed
feat(cat-gateway): impl Query for InsertUnstakedTxoAsset
1 parent 8e96ffd commit 11ab25a

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

catalyst-gateway/bin/src/db/index/block/txo/insert_unstaked_txo_asset.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
//! Insert Unstaked TXO Native Assets into the DB.
22
3-
use std::sync::Arc;
3+
use std::{fmt, sync::Arc};
44

55
use cardano_blockchain_types::{Slot, TransactionId, TxnIndex, TxnOutputOffset};
66
use scylla::{SerializeRow, Session};
77
use tracing::error;
88

99
use crate::{
1010
db::{
11-
index::queries::{PreparedQueries, SizedBatch},
11+
index::queries::{PreparedQueries, Query, QueryKind, SizedBatch},
1212
types::{DbSlot, DbTransactionId, DbTxnIndex, DbTxnOutputOffset},
1313
},
1414
settings::cassandra_db,
@@ -37,6 +37,22 @@ pub(crate) struct Params {
3737
value: num_bigint::BigInt,
3838
}
3939

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+
4056
impl Params {
4157
/// Create a new record for this transaction.
4258
///

0 commit comments

Comments
 (0)