Struct hdk::prelude::query::ChainQueryFilter
source · pub struct ChainQueryFilter {
pub sequence_range: ChainQueryFilterRange,
pub entry_type: Option<EntryType>,
pub entry_hashes: Option<HashSet<HoloHash<Entry>, RandomState>>,
pub action_type: Option<ActionType>,
pub include_entries: bool,
pub order_descending: bool,
}
Expand description
Specifies arguments to a query of the source chain, including ordering and filtering.
This struct is used to construct an actual SQL query on the database, and also has methods to allow filtering in-memory.
Fields§
§sequence_range: ChainQueryFilterRange
Limit the results to a range of records according to their actions.
entry_type: Option<EntryType>
Filter by EntryType
entry_hashes: Option<HashSet<HoloHash<Entry>, RandomState>>
Filter by a list of EntryHash
.
action_type: Option<ActionType>
Filter by ActionType
include_entries: bool
Include the entries in the records
order_descending: bool
The query should be ordered in descending order (default is ascending), when run as a database query. There is no provisioning for in-memory ordering.
Implementations§
source§impl ChainQueryFilter
impl ChainQueryFilter
sourcepub fn new() -> ChainQueryFilter
pub fn new() -> ChainQueryFilter
Create a no-op ChainQueryFilter which returns everything.
sourcepub fn sequence_range(
self,
sequence_range: ChainQueryFilterRange
) -> ChainQueryFilter
pub fn sequence_range(
self,
sequence_range: ChainQueryFilterRange
) -> ChainQueryFilter
Filter on sequence range.
sourcepub fn entry_type(self, entry_type: EntryType) -> ChainQueryFilter
pub fn entry_type(self, entry_type: EntryType) -> ChainQueryFilter
Filter on entry type.
sourcepub fn entry_hashes(
self,
entry_hashes: HashSet<HoloHash<Entry>, RandomState>
) -> ChainQueryFilter
pub fn entry_hashes(
self,
entry_hashes: HashSet<HoloHash<Entry>, RandomState>
) -> ChainQueryFilter
Filter on entry hashes.
sourcepub fn action_type(self, action_type: ActionType) -> ChainQueryFilter
pub fn action_type(self, action_type: ActionType) -> ChainQueryFilter
Filter on action type.
sourcepub fn include_entries(self, include_entries: bool) -> ChainQueryFilter
pub fn include_entries(self, include_entries: bool) -> ChainQueryFilter
Include the entries in the RecordsVec that is returned.
sourcepub fn ascending(self) -> ChainQueryFilter
pub fn ascending(self) -> ChainQueryFilter
Set the order to ascending.
sourcepub fn descending(self) -> ChainQueryFilter
pub fn descending(self) -> ChainQueryFilter
Set the order to ascending.
sourcepub fn disambiguate_forks(
&self,
actions: Vec<HoloHashed<Action>, Global>
) -> Vec<HoloHashed<Action>, Global> ⓘ
pub fn disambiguate_forks(
&self,
actions: Vec<HoloHashed<Action>, Global>
) -> Vec<HoloHashed<Action>, Global> ⓘ
If the sequence range supports fork disambiguation, apply it to remove actions that are not in the correct branch. Numerical range bounds do NOT support fork disambiguation, and neither does unbounded, but everything hash bounded does.
sourcepub fn filter_actions(
&self,
actions: Vec<HoloHashed<Action>, Global>
) -> Vec<HoloHashed<Action>, Global> ⓘ
pub fn filter_actions(
&self,
actions: Vec<HoloHashed<Action>, Global>
) -> Vec<HoloHashed<Action>, Global> ⓘ
Filter a vector of hashed actions according to the query.
sourcepub fn filter_records(
&self,
records: Vec<Record<SignedHashed<Action>>, Global>
) -> Vec<Record<SignedHashed<Action>>, Global> ⓘ
pub fn filter_records(
&self,
records: Vec<Record<SignedHashed<Action>>, Global>
) -> Vec<Record<SignedHashed<Action>>, Global> ⓘ
Filter a vector of records according to the query.
Trait Implementations§
source§impl Clone for ChainQueryFilter
impl Clone for ChainQueryFilter
source§fn clone(&self) -> ChainQueryFilter
fn clone(&self) -> ChainQueryFilter
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more