Skip to content

Commit 0ffcbb5

Browse files
committed
feat(cat-gateway): impl Query for InsertUnstakedTxo
1 parent c7921cf commit 0ffcbb5

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.rs

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
//! Insert Unstaked TXOs into the DB.
2-
use std::sync::Arc;
2+
use std::{fmt, sync::Arc};
33

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

88
use crate::{
99
db::{
10-
index::queries::{PreparedQueries, SizedBatch},
10+
index::queries::{PreparedQueries, Query, QueryKind, SizedBatch},
1111
types::{DbSlot, DbTransactionId, DbTxnIndex, DbTxnOutputOffset},
1212
},
1313
settings::cassandra_db,
@@ -34,6 +34,22 @@ pub(crate) struct Params {
3434
value: num_bigint::BigInt,
3535
}
3636

37+
impl fmt::Display for Params {
38+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
39+
write!(f, "{INSERT_UNSTAKED_TXO_QUERY}")
40+
}
41+
}
42+
43+
impl Query for Params {
44+
async fn prepare_query(
45+
session: &Arc<Session>, cfg: &cassandra_db::EnvVars,
46+
) -> anyhow::Result<crate::db::index::queries::QueryKind> {
47+
Params::prepare_batch(session, cfg)
48+
.await
49+
.map(QueryKind::Batch)
50+
}
51+
}
52+
3753
impl Params {
3854
/// Create a new record for this transaction.
3955
pub(crate) fn new(

0 commit comments

Comments
 (0)