pub enum PrimaryKey<'a> {
Flat {
name: &'a str,
field_id: FieldId,
},
Nested {
name: &'a str,
},
}
Expand description
A type that represent the type of primary key that has been set for this index, a classic flat one or a nested one.
Variants§
Implementations§
Source§impl<'a> PrimaryKey<'a>
impl<'a> PrimaryKey<'a>
pub fn new(path: &'a str, fields: &impl FieldIdMapper) -> Option<Self>
pub fn new_or_insert( path: &'a str, fields: &mut impl MutFieldIdMapper, ) -> StdResult<Self, UserError>
pub fn name(&self) -> &'a str
pub fn document_id( &self, document: &KvReader<FieldId>, fields: &impl FieldIdMapper, ) -> Result<StdResult<String, DocumentIdExtractionError>>
pub fn extract_docid_from_db<'pl, 'bump: 'pl, Mapper: FieldIdMapper>( &self, document: &'pl KvReaderFieldId, db_fields_ids_map: &Mapper, indexer: &'bump Bump, ) -> Result<DeOrBumpStr<'pl, 'bump>>
pub fn extract_fields_and_docid<'pl, 'bump: 'pl, Mapper: MutFieldIdMapper>( &self, document: &'pl RawValue, new_fields_ids_map: &mut Mapper, indexer: &'bump Bump, ) -> Result<DeOrBumpStr<'pl, 'bump>>
Sourcepub fn possible_level_names(
&self,
) -> impl Iterator<Item = (&'a str, &'a str)> + '_
pub fn possible_level_names( &self, ) -> impl Iterator<Item = (&'a str, &'a str)> + '_
Returns an Iterator
that gives all the possible fields names the primary key
can have depending of the first level name and depth of the objects.
Trait Implementations§
Source§impl<'a> Clone for PrimaryKey<'a>
impl<'a> Clone for PrimaryKey<'a>
Source§fn clone(&self) -> PrimaryKey<'a>
fn clone(&self) -> PrimaryKey<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'a> Debug for PrimaryKey<'a>
impl<'a> Debug for PrimaryKey<'a>
impl<'a> Copy for PrimaryKey<'a>
Auto Trait Implementations§
impl<'a> Freeze for PrimaryKey<'a>
impl<'a> RefUnwindSafe for PrimaryKey<'a>
impl<'a> Send for PrimaryKey<'a>
impl<'a> Sync for PrimaryKey<'a>
impl<'a> Unpin for PrimaryKey<'a>
impl<'a> UnwindSafe for PrimaryKey<'a>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> ⓘ
Converts
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> ⓘ
Converts
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 more