Skip to content

Commit 674ef1a

Browse files
committed
wip(cat-gateway): update implementation query trait for UpdateTxoSpent
1 parent 464d781 commit 674ef1a

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

catalyst-gateway/bin/src/db/index/queries/staked_ada/update_txo_spent.rs

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
//! Update the TXO Spent column to optimize future queries.
22
3-
use std::{fmt, sync::Arc};
3+
use std::sync::Arc;
44

55
use scylla::{SerializeRow, Session};
66
use tracing::error;
77

88
use crate::{
99
db::{
1010
index::{
11-
queries::{
12-
FallibleQueryResults, PreparedQueries, PreparedQuery, Query, QueryKind, SizedBatch,
13-
},
11+
queries::{FallibleQueryResults, PreparedQueries, PreparedQuery, SizedBatch},
1412
session::CassandraSession,
1513
},
1614
types::{DbSlot, DbStakeAddress, DbTxnIndex, DbTxnOutputOffset},
1715
},
16+
impl_query_batch,
1817
settings::cassandra_db,
1918
};
2019

@@ -39,22 +38,7 @@ pub(crate) struct UpdateTxoSpentQueryParams {
3938
/// Update TXO spent query.
4039
pub(crate) struct UpdateTxoSpentQuery;
4140

42-
impl Query for UpdateTxoSpentQuery {
43-
/// Prepare Batch of Insert TXI Index Data Queries
44-
async fn prepare_query(
45-
session: &Arc<Session>, cfg: &cassandra_db::EnvVars,
46-
) -> anyhow::Result<QueryKind> {
47-
Self::prepare_batch(session, cfg)
48-
.await
49-
.map(QueryKind::Batch)
50-
}
51-
}
52-
53-
impl fmt::Display for UpdateTxoSpentQuery {
54-
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
55-
write!(f, "{UPDATE_TXO_SPENT_QUERY}")
56-
}
57-
}
41+
impl_query_batch!(UpdateTxoSpentQuery, UPDATE_TXO_SPENT_QUERY);
5842

5943
impl UpdateTxoSpentQuery {
6044
/// Prepare a batch of update TXO spent queries.

0 commit comments

Comments
 (0)