nostrdb-rs

nostrdb in rust!
git clone git://jb55.com/nostrdb-rs
Log | Files | Refs | Submodules | README | LICENSE

query.rs (617B)


      1 use crate::{bindings, Note, NoteKey, Transaction};
      2 
      3 #[derive(Debug)]
      4 pub struct QueryResult<'a> {
      5     pub note: Note<'a>,
      6     pub note_size: u64,
      7     pub note_key: NoteKey,
      8 }
      9 
     10 impl<'a> QueryResult<'a> {
     11     pub fn new(result: &bindings::ndb_query_result, txn: &'a Transaction) -> Self {
     12         QueryResult {
     13             note: Note::new_transactional(
     14                 result.note,
     15                 result.note_size as usize,
     16                 NoteKey::new(result.note_id),
     17                 txn,
     18             ),
     19             note_size: result.note_size,
     20             note_key: NoteKey::new(result.note_id),
     21         }
     22     }
     23 }