Struct holochain::prelude::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
sourceimpl 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
sourceimpl Clone for ChainQueryFilter
impl Clone for ChainQueryFilter
sourcefn clone(&self) -> ChainQueryFilter
fn clone(&self) -> ChainQueryFilter
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresourceimpl Debug for ChainQueryFilter
impl Debug for ChainQueryFilter
sourceimpl Default for ChainQueryFilter
impl Default for ChainQueryFilter
sourcefn default() -> ChainQueryFilter
fn default() -> ChainQueryFilter
sourceimpl<'de> Deserialize<'de> for ChainQueryFilter
impl<'de> Deserialize<'de> for ChainQueryFilter
sourcefn 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>,
sourceimpl PartialEq<ChainQueryFilter> for ChainQueryFilter
impl PartialEq<ChainQueryFilter> for ChainQueryFilter
sourcefn eq(&self, other: &ChainQueryFilter) -> bool
fn eq(&self, other: &ChainQueryFilter) -> bool
sourceimpl Serialize for ChainQueryFilter
impl Serialize for ChainQueryFilter
sourcefn 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,
sourceimpl TryFrom<&ChainQueryFilter> for SerializedBytes
impl TryFrom<&ChainQueryFilter> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(
t: &ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(
t: &ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<ChainQueryFilter> for SerializedBytes
impl TryFrom<ChainQueryFilter> for SerializedBytes
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn try_from(
t: ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
fn try_from(
t: ChainQueryFilter
) -> Result<SerializedBytes, SerializedBytesError>
sourceimpl TryFrom<SerializedBytes> for ChainQueryFilter
impl TryFrom<SerializedBytes> for ChainQueryFilter
type Error = SerializedBytesError
type Error = SerializedBytesError
sourcefn 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> Any for Twhere
T: Any + ?Sized,
impl<T> Any for Twhere
T: Any + ?Sized,
fn type_id_compat(&self) -> TypeId
fn type_id_compat(&self) -> TypeId
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn 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>
impl<T> FutureExt for T
impl<T> FutureExt for T
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
sourcefn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
sourcefn 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 morefn 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.