pub struct Database<S: Schema = Unbound> { /* private fields */ }Expand description
Primary database session handle type-branded by schema S.
Implementations§
Source§impl<S: Schema> Database<S>
impl<S: Schema> Database<S>
Sourcepub fn query(&self) -> Result<QuerySession<'_, S>>
pub fn query(&self) -> Result<QuerySession<'_, S>>
Start one owner-branded query authoring session over this schema-bound database.
Source§impl Database<Unbound>
impl Database<Unbound>
Sourcepub async fn connect(
options: impl Into<ConnectionOptions>,
) -> Result<Database<Unbound>>
pub async fn connect( options: impl Into<ConnectionOptions>, ) -> Result<Database<Unbound>>
Connect to a TypeDB server returning an unbound database handle.
Sourcepub fn with_schema<S: Schema>(
self,
schema: SchemaPackage<S>,
) -> Result<Database<S>>
pub fn with_schema<S: Schema>( self, schema: SchemaPackage<S>, ) -> Result<Database<S>>
Bind and verify a generated schema package, transitioning to Database<S>.
Source§impl<S: Schema> Database<S>
impl<S: Schema> Database<S>
Sourcepub fn entities<M>(&self) -> EntityManager<'_, S, M>where
M: EntityModel<Schema = S>,
pub fn entities<M>(&self) -> EntityManager<'_, S, M>where
M: EntityModel<Schema = S>,
Create a lightweight client-owned exact entity manager.
Sourcepub fn relations<M>(&self) -> RelationManager<'_, S, M>where
M: RelationModel<Schema = S>,
pub fn relations<M>(&self) -> RelationManager<'_, S, M>where
M: RelationModel<Schema = S>,
Create a lightweight client-owned exact relation manager.
Sourcepub async fn write(&self) -> Result<WriteTransaction<'_, S>>
pub async fn write(&self) -> Result<WriteTransaction<'_, S>>
Open one client-owned write transaction over this schema-bound database. Operations on its borrowed managers never auto-commit; the caller terminally commits or rolls back, and dropping the open transaction releases the context without commit.
Sourcepub async fn read(&self) -> Result<ReadTransaction<'_, S>>
pub async fn read(&self) -> Result<ReadTransaction<'_, S>>
Open one reusable client-owned read transaction. Query terminals borrow and reuse its retained context until explicit close or drop.
Sourcepub fn database_name(&self) -> &str
pub fn database_name(&self) -> &str
Return the target database name.
Sourcepub fn is_schema_bound(&self) -> bool
pub fn is_schema_bound(&self) -> bool
Return whether this database handle is bound to a verified schema.
Auto Trait Implementations§
impl<S = Unbound> !RefUnwindSafe for Database<S>
impl<S = Unbound> !UnwindSafe for Database<S>
impl<S> Freeze for Database<S>
impl<S> Send for Database<S>
impl<S> Sync for Database<S>
impl<S> Unpin for Database<S>
impl<S> UnsafeUnpin for Database<S>
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
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request