Struct nostr_db::Filter

source ·
pub struct Filter {
    pub ids: Option<Vec<String>>,
    pub authors: Option<Vec<String>>,
    pub kinds: Option<Vec<u64>>,
    pub since: Option<u64>,
    pub until: Option<u64>,
    pub limit: Option<u64>,
    pub search: Option<String>,
    pub tags: HashMap<Vec<u8>, TagList>,
    pub desc: bool,
    pub words: Option<Vec<Vec<u8>>>,
}
Expand description

Events filter

NIP-01

Fields§

§ids: Option<Vec<String>>

a list of event ids or prefixes

§authors: Option<Vec<String>>

a list of pubkeys or prefixes, the pubkey of an event must be one of these

§kinds: Option<Vec<u64>>

a list of a kind numbers

§since: Option<u64>§until: Option<u64>§limit: Option<u64>§search: Option<String>§tags: HashMap<Vec<u8>, TagList>

tags starts with “#”, key tag length 1

§desc: bool

Query by time descending order

§words: Option<Vec<Vec<u8>>>

Implementations§

source§

impl Filter

source

pub fn default_limit(&mut self, limit: u64)

source

pub fn set_tags(&mut self, tags: HashMap<String, Vec<String>>)

source

pub fn match_id<K: AsRef<[u8]>>(ids: Option<&Vec<String>>, id: K) -> bool

source

pub fn match_author<P: AsRef<[u8]>, D: AsRef<[u8]>>( authors: Option<&Vec<String>>, pubkey: P, delegator: Option<D> ) -> bool

source

pub fn match_kind(kinds: Option<&Vec<u64>>, kind: u64) -> bool

source

pub fn match_tag<V: AsRef<[u8]>, I: AsRef<[(V, V)]>>( tags: &HashMap<Vec<u8>, TagList>, event_tags: I ) -> bool

source

pub fn match(&self, event: &EventIndex) -> bool

source

pub fn match_except_tag(&self, event: &EventIndex) -> bool

source

pub fn match_archived(&self, event: &ArchivedEventIndex) -> bool

source

pub fn match_archived_except_tag(&self, event: &ArchivedEventIndex) -> bool

Trait Implementations§

source§

impl Clone for Filter

source§

fn clone(&self) -> Filter

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Filter

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Filter

source§

fn default() -> Filter

Returns the “default value” for a type. Read more
source§

impl<'de> Deserialize<'de> for Filter

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl FromStr for Filter

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
source§

impl PartialEq<Filter> for Filter

source§

fn eq(&self, other: &Filter) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for Filter

source§

impl StructuralEq for Filter

source§

impl StructuralPartialEq for Filter

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> ArchivePointee for T

§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<F, W, T, D> Deserialize<With<T, W>, D> for Fwhere W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

source§

fn deserialize( &self, deserializer: &mut D ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> LayoutRaw for T

source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
§

impl<T> Pointee for T

§

type Metadata = ()

The type for metadata in pointers and references to Self.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> DeserializeOwned for Twhere T: for<'de> Deserialize<'de>,