Struct typedb_driver::driver::TypeDBDriver
source · 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 async fn new_core_with_description( address: impl AsRef<str>, driver_lang: impl AsRef<str>, driver_version: impl AsRef<str>, ) -> Result<Self>
sourcepub fn new_cloud<T: AsRef<str> + Sync>(
init_addresses: &[T],
credential: Credential,
) -> Result<Self>
pub fn new_cloud<T: AsRef<str> + Sync>( init_addresses: &[T], credential: Credential, ) -> Result<Self>
Creates a new TypeDB Cloud connection.
§Arguments
init_addresses
– Addresses (host:port) on which TypeDB Cloud nodes are runningcredential
– User credential and TLS encryption setting
§Examples
Connection::new_cloud(
&["localhost:11729", "localhost:21729", "localhost:31729"],
Credential::with_tls(
"admin",
"password",
Some(&PathBuf::from(
std::env::var("ROOT_CA")
.expect("ROOT_CA environment variable needs to be set for cloud tests to run"),
)),
)?,
)
sourcepub fn new_cloud_with_translation<T, U>(
address_translation: HashMap<T, U>,
credential: Credential,
) -> Result<Self>
pub fn new_cloud_with_translation<T, U>( address_translation: HashMap<T, U>, credential: Credential, ) -> Result<Self>
Creates a new TypeDB Cloud connection.
§Arguments
address_translation
– Translation map from addresses to be used by the driver for connection to addresses received from the TypeDB server(s)credential
– User credential and TLS encryption setting
§Examples
Connection::new_cloud_with_translation(
[
("typedb-cloud.ext:11729", "localhost:11729"),
("typedb-cloud.ext:21729", "localhost:21729"),
("typedb-cloud.ext:31729", "localhost:31729"),
].into(),
credential,
)
pub fn databases(&self) -> &DatabaseManager
pub fn users(&self) -> &UserManager
pub async fn transaction( &self, database_name: impl AsRef<str>, transaction_type: TransactionType, ) -> Result<Transaction>
pub async fn transaction_with_options( &self, database_name: impl AsRef<str>, transaction_type: TransactionType, options: Options, ) -> Result<Transaction>
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
source§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