pub struct QueryFilter {
pub sequence_range: ChainQueryFilterRange,
pub entry_type: Option<Vec<EntryType>>,
pub entry_hashes: Option<HashSet<HoloHash<Entry>>>,
pub action_type: Option<Vec<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 is used by both hdk::chain::query and hdk::chain::get_agent_activity, although the
latter function ignores it if ActivityRequest::Status is used.
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: ChainQueryFilterRangeLimit the results to a range of records according to their actions.
entry_type: Option<Vec<EntryType>>Filter by a list of EntryTypes.
entry_hashes: Option<HashSet<HoloHash<Entry>>>Filter by a set of EntryHashes.
action_type: Option<Vec<ActionType>>Filter by a list of ActionTypes.
include_entries: boolInclude the entries for the actions.
The source of chain data being used must include entries. When used with
hdk::chain::get_agent_activity, or when invoking one of the helper methods on
ChainQueryFilter that can be used with a vector of actions, this value is unused
because the entry data isn’t available.
order_descending: boolThe 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>>,
) -> ChainQueryFilter
pub fn entry_hashes( self, entry_hashes: HashSet<HoloHash<Entry>>, ) -> 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 for the actions. The source of chain data being used
must include entries – when used with hdk::chain::get_agent_activity,
or when invoking one of the helper methods on ChainQueryFilter that
can be used with a vector of actions, this value is unused because the
entry data isn’t available.
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<T>(&self, actions: Vec<T>) -> Vec<T>where
T: ActionHashedContainer + Clone,
pub fn disambiguate_forks<T>(&self, actions: Vec<T>) -> Vec<T>where
T: ActionHashedContainer + Clone,
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<T>(&self, actions: Vec<T>) -> Vec<T>where
T: ActionHashedContainer + Clone,
pub fn filter_actions<T>(&self, actions: Vec<T>) -> Vec<T>where
T: ActionHashedContainer + Clone,
Filter a vector of hashed actions according to the query.
Sourcepub fn filter_records(&self, records: Vec<Record>) -> Vec<Record>
pub fn filter_records(&self, records: Vec<Record>) -> Vec<Record>
Filter a vector of records according to the query.
A Record is an ActionHashedContainer, so this is just
Self::filter_actions specialised to records.
Trait Implementations§
Source§impl Clone for ChainQueryFilter
impl Clone for ChainQueryFilter
Source§fn clone(&self) -> ChainQueryFilter
fn clone(&self) -> ChainQueryFilter
1.0.0 (const: unstable) · 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 for ChainQueryFilter
impl PartialEq for ChainQueryFilter
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,
impl StructuralPartialEq for ChainQueryFilter
Source§impl TryFrom<&ChainQueryFilter> for SerializedBytes
impl TryFrom<&ChainQueryFilter> for SerializedBytes
Source§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
Source§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
Source§type Error = SerializedBytesError
type Error = SerializedBytesError
Source§fn try_from(
sb: SerializedBytes,
) -> Result<ChainQueryFilter, SerializedBytesError>
fn try_from( sb: SerializedBytes, ) -> Result<ChainQueryFilter, SerializedBytesError>
Auto Trait Implementations§
impl Freeze for ChainQueryFilter
impl RefUnwindSafe for ChainQueryFilter
impl Send for ChainQueryFilter
impl Sync for ChainQueryFilter
impl Unpin for ChainQueryFilter
impl UnsafeUnpin for ChainQueryFilter
impl UnwindSafe for ChainQueryFilter
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<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>
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.