Struct bonsaidb_core::admin::Database
source · pub struct Database { /* private fields */ }
Expand description
A database stored in BonsaiDb.
Trait Implementations§
source§impl Collection for Database
impl Collection for Database
§type PrimaryKey = u64
type PrimaryKey = u64
The unique id type. Each document stored in a collection will be
uniquely identified by this type. Read more
source§fn collection_name() -> CollectionName
fn collection_name() -> CollectionName
The unique name of this collection. Each collection must be uniquely
named within the
Schema
it is registered
within.source§impl DefaultSerialization for Database
impl DefaultSerialization for Database
source§fn natural_id(&self) -> Option<Self::PrimaryKey>
fn natural_id(&self) -> Option<Self::PrimaryKey>
Returns the natural identifier of
contents
. This is called when
pushing values into a collection, before attempting to automatically
assign a unique id.source§impl<'de> Deserialize<'de> for Database
impl<'de> Deserialize<'de> for Database
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
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 NamedCollection for Database
impl NamedCollection for Database
§type ByNameView = ByName
type ByNameView = ByName
The name view defined for the collection.
source§fn load<'name, N: Nameable<'name, Self::PrimaryKey> + Send + Sync, C: Connection>(
id: N,
connection: &C
) -> Result<Option<CollectionDocument<Self>>, Error>where
Self: SerializedCollection + Sized + 'static,
fn load<'name, N: Nameable<'name, Self::PrimaryKey> + Send + Sync, C: Connection>( id: N, connection: &C ) -> Result<Option<CollectionDocument<Self>>, Error>where Self: SerializedCollection + Sized + 'static,
source§fn load_async<'name, 'life0, 'async_trait, N, C>(
id: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait>>where
Self: SerializedCollection + Sized + 'static + Send + 'async_trait,
N: 'async_trait + Nameable<'name, Self::PrimaryKey> + Send + Sync,
C: 'async_trait + AsyncConnection,
'name: 'async_trait,
'life0: 'async_trait,
fn load_async<'name, 'life0, 'async_trait, N, C>( id: N, connection: &'life0 C ) -> Pin<Box<dyn Future<Output = Result<Option<CollectionDocument<Self>>, Error>> + Send + 'async_trait>>where Self: SerializedCollection + Sized + 'static + Send + 'async_trait, N: 'async_trait + Nameable<'name, Self::PrimaryKey> + Send + Sync, C: 'async_trait + AsyncConnection, 'name: 'async_trait, 'life0: 'async_trait,
source§fn entry<'connection, 'name, N: Into<NamedReference<'name, Self::PrimaryKey>> + Send + Sync, C: Connection>(
id: N,
connection: &'connection C
) -> Entry<'connection, 'name, C, Self, (), ()>where
Self: SerializedCollection + Sized,
fn entry<'connection, 'name, N: Into<NamedReference<'name, Self::PrimaryKey>> + Send + Sync, C: Connection>( id: N, connection: &'connection C ) -> Entry<'connection, 'name, C, Self, (), ()>where Self: SerializedCollection + Sized,
source§fn entry_async<'connection, 'name, N: Into<NamedReference<'name, Self::PrimaryKey>> + Send + Sync, C: AsyncConnection>(
id: N,
connection: &'connection C
) -> AsyncEntry<'connection, 'name, C, Self, (), ()> ⓘwhere
Self: SerializedCollection + Sized,
fn entry_async<'connection, 'name, N: Into<NamedReference<'name, Self::PrimaryKey>> + Send + Sync, C: AsyncConnection>( id: N, connection: &'connection C ) -> AsyncEntry<'connection, 'name, C, Self, (), ()> ⓘwhere Self: SerializedCollection + Sized,
source§fn load_document<'name, N: Nameable<'name, Self::PrimaryKey> + Send + Sync, C: Connection>(
name: N,
connection: &C
) -> Result<Option<OwnedDocument>, Error>where
Self: SerializedCollection + Sized,
fn load_document<'name, N: Nameable<'name, Self::PrimaryKey> + Send + Sync, C: Connection>( name: N, connection: &C ) -> Result<Option<OwnedDocument>, Error>where Self: SerializedCollection + Sized,
Loads a document from this collection by name, if applicable. Return
Ok(None)
if unsupported.source§fn load_document_async<'name, 'life0, 'async_trait, N, C>(
name: N,
connection: &'life0 C
) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where
Self: SerializedCollection + Sized + Send + 'async_trait,
N: 'async_trait + Nameable<'name, Self::PrimaryKey> + Send + Sync,
C: 'async_trait + AsyncConnection,
'name: 'async_trait,
'life0: 'async_trait,
fn load_document_async<'name, 'life0, 'async_trait, N, C>( name: N, connection: &'life0 C ) -> Pin<Box<dyn Future<Output = Result<Option<OwnedDocument>, Error>> + Send + 'async_trait>>where Self: SerializedCollection + Sized + Send + 'async_trait, N: 'async_trait + Nameable<'name, Self::PrimaryKey> + Send + Sync, C: 'async_trait + AsyncConnection, 'name: 'async_trait, 'life0: 'async_trait,
Loads a document from this collection by name, if applicable. Return
Ok(None)
if unsupported.source§fn delete_by_name<C: Connection>(
name: &str,
connection: &C
) -> Result<bool, Error>where
Self: SerializedCollection + Sized,
fn delete_by_name<C: Connection>( name: &str, connection: &C ) -> Result<bool, Error>where Self: SerializedCollection + Sized,
Deletes a document by its name. Returns true if a document was deleted.
source§fn delete_by_name_async<'life0, 'life1, 'async_trait, C>(
name: &'life0 str,
connection: &'life1 C
) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where
Self: SerializedCollection + Sized + Send + 'async_trait,
C: 'async_trait + AsyncConnection,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_by_name_async<'life0, 'life1, 'async_trait, C>( name: &'life0 str, connection: &'life1 C ) -> Pin<Box<dyn Future<Output = Result<bool, Error>> + Send + 'async_trait>>where Self: SerializedCollection + Sized + Send + 'async_trait, C: 'async_trait + AsyncConnection, 'life0: 'async_trait, 'life1: 'async_trait,
Deletes a document by its name. Returns true if a document was deleted.
source§impl PartialEq<Database> for Database
impl PartialEq<Database> for Database
impl Eq for Database
impl StructuralEq for Database
impl StructuralPartialEq for Database
Auto Trait Implementations§
impl RefUnwindSafe for Database
impl Send for Database
impl Sync for Database
impl Unpin for Database
impl UnwindSafe for Database
Blanket Implementations§
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> Schema for Twhere
T: Collection + 'static,
impl<T> Schema for Twhere T: Collection + 'static,
source§fn schema_name() -> SchemaName
fn schema_name() -> SchemaName
Returns the unique
SchemaName
for this schema.