Struct holochain_zome_types::query::ChainQueryFilter
source · pub struct ChainQueryFilter {
pub sequence_range: ChainQueryFilterRange,
pub entry_type: Option<EntryType>,
pub entry_hashes: Option<HashSet<EntryHash>>,
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<EntryHash>>
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 sequence_range(self, sequence_range: ChainQueryFilterRange) -> Self
pub fn sequence_range(self, sequence_range: ChainQueryFilterRange) -> Self
Filter on sequence range.
sourcepub fn entry_type(self, entry_type: EntryType) -> Self
pub fn entry_type(self, entry_type: EntryType) -> Self
Filter on entry type.
sourcepub fn entry_hashes(self, entry_hashes: HashSet<EntryHash>) -> Self
pub fn entry_hashes(self, entry_hashes: HashSet<EntryHash>) -> Self
Filter on entry hashes.
sourcepub fn action_type(self, action_type: ActionType) -> Self
pub fn action_type(self, action_type: ActionType) -> Self
Filter on action type.
sourcepub fn include_entries(self, include_entries: bool) -> Self
pub fn include_entries(self, include_entries: bool) -> Self
Include the entries in the RecordsVec that is returned.
sourcepub fn descending(self) -> Self
pub fn descending(self) -> Self
Set the order to ascending.
sourcepub fn disambiguate_forks(
&self,
actions: Vec<ActionHashed>
) -> Vec<ActionHashed> ⓘ
pub fn disambiguate_forks( &self, actions: Vec<ActionHashed> ) -> Vec<ActionHashed> ⓘ
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<ActionHashed>) -> Vec<ActionHashed> ⓘ
pub fn filter_actions(&self, actions: Vec<ActionHashed>) -> Vec<ActionHashed> ⓘ
Filter a vector of hashed actions 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<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::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§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
§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>
§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.