1
1
//! Insert Unstaked TXOs into the DB.
2
- use std:: sync:: Arc ;
2
+ use std:: { fmt , sync:: Arc } ;
3
3
4
4
use cardano_blockchain_types:: { Slot , TransactionId , TxnIndex , TxnOutputOffset } ;
5
5
use scylla:: { SerializeRow , Session } ;
6
6
use tracing:: error;
7
7
8
8
use crate :: {
9
9
db:: {
10
- index:: queries:: { PreparedQueries , SizedBatch } ,
10
+ index:: queries:: { PreparedQueries , Query , QueryKind , SizedBatch } ,
11
11
types:: { DbSlot , DbTransactionId , DbTxnIndex , DbTxnOutputOffset } ,
12
12
} ,
13
13
settings:: cassandra_db,
@@ -34,6 +34,22 @@ pub(crate) struct Params {
34
34
value : num_bigint:: BigInt ,
35
35
}
36
36
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
+
37
53
impl Params {
38
54
/// Create a new record for this transaction.
39
55
pub ( crate ) fn new (
0 commit comments