pub struct TypeDBDriver { /* private fields */ }
Expand description
A connection to a TypeDB server which serves as the starting point for all interaction.
Implementations§
Source§impl TypeDBDriver
impl TypeDBDriver
pub const DEFAULT_ADDRESS: &'static str = "localhost:1729"
Sourcepub async fn new(
address: impl AsRef<str>,
credentials: Credentials,
driver_options: DriverOptions,
) -> Result<Self>
pub async fn new( address: impl AsRef<str>, credentials: Credentials, driver_options: DriverOptions, ) -> Result<Self>
Sourcepub async fn new_with_description(
address: impl AsRef<str>,
credentials: Credentials,
driver_options: DriverOptions,
driver_lang: impl AsRef<str>,
) -> Result<Self>
pub async fn new_with_description( address: impl AsRef<str>, credentials: Credentials, driver_options: DriverOptions, driver_lang: impl AsRef<str>, ) -> Result<Self>
Creates a new TypeDB Server connection with a description.
This method is generally used by TypeDB drivers built on top of the Rust driver.
In other cases, use Self::new
instead.
§Arguments
address
— The address (host:port) on which the TypeDB Server is runningcredentials
— The Credentials to connect withdriver_options
— The DriverOptions to connect withdriver_lang
— The language of the driver connecting to the server
§Examples
TypeDBDriver::new_with_description("127.0.0.1:1729", "rust").await
pub fn databases(&self) -> &DatabaseManager
pub fn users(&self) -> &UserManager
Sourcepub async fn transaction(
&self,
database_name: impl AsRef<str>,
transaction_type: TransactionType,
) -> Result<Transaction>
pub async fn transaction( &self, database_name: impl AsRef<str>, transaction_type: TransactionType, ) -> Result<Transaction>
Opens a transaction with default options.
See TypeDBDriver::transaction_with_options
Sourcepub async fn transaction_with_options(
&self,
database_name: impl AsRef<str>,
transaction_type: TransactionType,
options: TransactionOptions,
) -> Result<Transaction>
pub async fn transaction_with_options( &self, database_name: impl AsRef<str>, transaction_type: TransactionType, options: TransactionOptions, ) -> Result<Transaction>
Performs a TypeQL query in this transaction.
§Arguments
database_name
— The name of the database to connect totransaction_type
— The TransactionType to open the transaction withoptions
— The TransactionOptions to open the transaction with
§Examples
transaction.transaction_with_options(database_name, transaction_type, options)
Sourcepub fn force_close(&self) -> Result
pub fn force_close(&self) -> Result
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for TypeDBDriver
impl !RefUnwindSafe for TypeDBDriver
impl Send for TypeDBDriver
impl Sync for TypeDBDriver
impl Unpin for TypeDBDriver
impl !UnwindSafe for TypeDBDriver
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> 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 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>
Wrap the input message
T
in a tonic::Request