-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #967 from fluidvanadium/note_query
Note query
- Loading branch information
Showing
8 changed files
with
245 additions
and
45 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
//! Contains structs for querying a database about notes. | ||
use derive_more::Constructor; | ||
use getset::Getters; | ||
|
||
/// Selects received notes by how they been spent | ||
#[derive(Getters, Constructor, Clone, Copy)] | ||
pub struct NoteSpendStatusQuery { | ||
/// will the query include unspent notes? | ||
#[getset(get = "pub")] | ||
unspent: bool, | ||
/// will the query include pending_spent notes? | ||
#[getset(get = "pub")] | ||
pending_spent: bool, | ||
/// will the query include spent notes? | ||
#[getset(get = "pub")] | ||
spent: bool, | ||
} | ||
|
||
/// Selects received notes by pool | ||
#[derive(Getters, Constructor, Clone, Copy)] | ||
pub struct NotePoolQuery { | ||
/// will the query include transparent notes? (coins) | ||
#[getset(get = "pub")] | ||
transparent: bool, | ||
/// will the query include sapling notes? | ||
#[getset(get = "pub")] | ||
sapling: bool, | ||
/// will the query include orchard notes? | ||
#[getset(get = "pub")] | ||
orchard: bool, | ||
} | ||
|
||
/// Selects received notes by any properties | ||
#[derive(Getters, Constructor, Clone, Copy)] | ||
pub struct NoteQuery { | ||
/// selects spend status properties | ||
#[getset(get = "pub")] | ||
spend_status: NoteSpendStatusQuery, | ||
/// selects pools | ||
#[getset(get = "pub")] | ||
pools: NotePoolQuery, | ||
} | ||
|
||
impl NoteQuery { | ||
/// will the query include unspent notes? | ||
pub fn unspent(&self) -> &bool { | ||
self.spend_status().unspent() | ||
} | ||
/// will the query include pending_spent notes? | ||
pub fn pending_spent(&self) -> &bool { | ||
self.spend_status().pending_spent() | ||
} | ||
/// will the query include spent notes? | ||
pub fn spent(&self) -> &bool { | ||
self.spend_status().spent() | ||
} | ||
/// will the query include transparent notes? (coins) | ||
pub fn transparent(&self) -> &bool { | ||
self.pools().transparent() | ||
} | ||
/// will the query include sapling notes? | ||
pub fn sapling(&self) -> &bool { | ||
self.pools().sapling() | ||
} | ||
/// will the query include orchard notes? | ||
pub fn orchard(&self) -> &bool { | ||
self.pools().orchard() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters