Skip to main content

Index

Struct Index 

Source
#[non_exhaustive]
pub struct Index { pub name: String, pub query_scope: QueryScope, pub api_scope: ApiScope, pub fields: Vec<IndexField>, pub state: State, pub density: Density, pub multikey: bool, pub shard_count: i32, /* private fields */ }
Expand description

Cloud Firestore indexes enable simple and complex queries against documents in a database.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§name: String

Output only. A server defined name for this index. The form of this name for composite indexes will be: projects/{project_id}/databases/{database_id}/collectionGroups/{collection_id}/indexes/{composite_index_id} For single field indexes, this field will be empty.

§query_scope: QueryScope

Indexes with a collection query scope specified allow queries against a collection that is the child of a specific document, specified at query time, and that has the same collection ID.

Indexes with a collection group query scope specified allow queries against all collections descended from a specific document, specified at query time, and that have the same collection ID as this index.

§api_scope: ApiScope

The API scope supported by this index.

§fields: Vec<IndexField>

The fields supported by this index.

For composite indexes, this requires a minimum of 2 and a maximum of 100 fields. The last field entry is always for the field path __name__. If, on creation, __name__ was not specified as the last field, it will be added automatically with the same direction as that of the last field defined. If the final field in a composite index is not directional, the __name__ will be ordered ASCENDING (unless explicitly specified).

For single field indexes, this will always be exactly one entry with a field path equal to the field path of the associated field.

§state: State

Output only. The serving state of the index.

§density: Density

Immutable. The density configuration of the index.

§multikey: bool

Optional. Whether the index is multikey. By default, the index is not multikey. For non-multikey indexes, none of the paths in the index definition reach or traverse an array, except via an explicit array index. For multikey indexes, at most one of the paths in the index definition reach or traverse an array, except via an explicit array index. Violations will result in errors.

Note this field only applies to index with MONGODB_COMPATIBLE_API ApiScope.

§shard_count: i32

Optional. The number of shards for the index.

Implementations§

Source§

impl Index

Source

pub fn new() -> Self

Source

pub fn set_name<T: Into<String>>(self, v: T) -> Self

Sets the value of name.

§Example
let x = Index::new().set_name("example");
Source

pub fn set_query_scope<T: Into<QueryScope>>(self, v: T) -> Self

Sets the value of query_scope.

§Example
use google_cloud_firestore_admin_v1::model::index::QueryScope;
let x0 = Index::new().set_query_scope(QueryScope::Collection);
let x1 = Index::new().set_query_scope(QueryScope::CollectionGroup);
let x2 = Index::new().set_query_scope(QueryScope::CollectionRecursive);
Source

pub fn set_api_scope<T: Into<ApiScope>>(self, v: T) -> Self

Sets the value of api_scope.

§Example
use google_cloud_firestore_admin_v1::model::index::ApiScope;
let x0 = Index::new().set_api_scope(ApiScope::DatastoreModeApi);
let x1 = Index::new().set_api_scope(ApiScope::MongodbCompatibleApi);
Source

pub fn set_fields<T, V>(self, v: T) -> Self
where T: IntoIterator<Item = V>, V: Into<IndexField>,

Sets the value of fields.

§Example
use google_cloud_firestore_admin_v1::model::index::IndexField;
let x = Index::new()
    .set_fields([
        IndexField::default()/* use setters */,
        IndexField::default()/* use (different) setters */,
    ]);
Source

pub fn set_state<T: Into<State>>(self, v: T) -> Self

Sets the value of state.

§Example
use google_cloud_firestore_admin_v1::model::index::State;
let x0 = Index::new().set_state(State::Creating);
let x1 = Index::new().set_state(State::Ready);
let x2 = Index::new().set_state(State::NeedsRepair);
Source

pub fn set_density<T: Into<Density>>(self, v: T) -> Self

Sets the value of density.

§Example
use google_cloud_firestore_admin_v1::model::index::Density;
let x0 = Index::new().set_density(Density::SparseAll);
let x1 = Index::new().set_density(Density::SparseAny);
let x2 = Index::new().set_density(Density::Dense);
Source

pub fn set_multikey<T: Into<bool>>(self, v: T) -> Self

Sets the value of multikey.

§Example
let x = Index::new().set_multikey(true);
Source

pub fn set_shard_count<T: Into<i32>>(self, v: T) -> Self

Sets the value of shard_count.

§Example
let x = Index::new().set_shard_count(42);

Trait Implementations§

Source§

impl Clone for Index

Source§

fn clone(&self) -> Index

Returns a duplicate 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 Index

Source§

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

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

impl Default for Index

Source§

fn default() -> Index

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

impl Message for Index

Source§

fn typename() -> &'static str

The typename of this message.
Source§

impl PartialEq for Index

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for Index

Auto Trait Implementations§

§

impl Freeze for Index

§

impl RefUnwindSafe for Index

§

impl Send for Index

§

impl Sync for Index

§

impl Unpin for Index

§

impl UnwindSafe for Index

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where 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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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 T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

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

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

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