Struct holochain::prelude::QueryFilter
source · pub struct QueryFilter {
pub sequence_range: ChainQueryFilterRange,
pub entry_type: Option<Vec<EntryType, Global>>,
pub entry_hashes: Option<HashSet<HoloHash<Entry>, RandomState>>,
pub action_type: Option<Vec<ActionType, Global>>,
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<Vec<EntryType, Global>>
Filter by EntryType
entry_hashes: Option<HashSet<HoloHash<Entry>, RandomState>>
Filter by a list of EntryHash
.
action_type: Option<Vec<ActionType, Global>>
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. This function can be called multiple times to create an OR query on all provided entry types.
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. This function can be called multiple times to create an OR query on all provided action types.
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 moresource§impl Debug for ChainQueryFilter
impl Debug for ChainQueryFilter
source§impl Default for ChainQueryFilter
impl Default for ChainQueryFilter
source§fn default() -> ChainQueryFilter
fn default() -> ChainQueryFilter
source§impl<'de> Deserialize<'de> for ChainQueryFilter
impl<'de> Deserialize<'de> for ChainQueryFilter
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<ChainQueryFilter, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>( __deserializer: __D ) -> Result<ChainQueryFilter, <__D as Deserializer<'de>>::Error>where __D: Deserializer<'de>,
source§impl PartialEq<ChainQueryFilter> for ChainQueryFilter
impl PartialEq<ChainQueryFilter> for ChainQueryFilter
source§fn eq(&self, other: &ChainQueryFilter) -> bool
fn eq(&self, other: &ChainQueryFilter) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for ChainQueryFilter
impl Serialize for ChainQueryFilter
source§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>( &self, __serializer: __S ) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where __S: Serializer,
source§impl TryFrom<&ChainQueryFilter> for SerializedBytes
impl TryFrom<&ChainQueryFilter> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(
t: &ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
fn try_from( t: &ChainQueryFilter ) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<ChainQueryFilter> for SerializedBytes
impl TryFrom<ChainQueryFilter> for SerializedBytes
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(
t: ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
fn try_from( t: ChainQueryFilter ) -> Result<SerializedBytes, SerializedBytesError>
source§impl TryFrom<SerializedBytes> for ChainQueryFilter
impl TryFrom<SerializedBytes> for ChainQueryFilter
§type Error = SerializedBytesError
type Error = SerializedBytesError
source§fn try_from(
sb: SerializedBytes
) -> Result<ChainQueryFilter, SerializedBytesError>
fn try_from( sb: SerializedBytes ) -> Result<ChainQueryFilter, SerializedBytesError>
impl StructuralPartialEq for ChainQueryFilter
Auto Trait Implementations§
impl RefUnwindSafe for ChainQueryFilter
impl Send for ChainQueryFilter
impl Sync for ChainQueryFilter
impl Unpin for ChainQueryFilter
impl UnwindSafe for ChainQueryFilter
Blanket Implementations§
§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
§type ArchivedMetadata = ()
type ArchivedMetadata = ()
§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere
W: DeserializeWith<F, T, D>,
D: Fallible + ?Sized,
F: ?Sized,
impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,
§fn deserialize(
&self,
deserializer: &mut D
) -> Result<With<T, W>, <D as Fallible>::Error>
fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.