[−][src]Struct arangors::connection::GenericConnection
Connection is the top level API for this crate. It contains a http client, information about authentication, arangodb url.
Implementations
impl<S, C: ClientExt> GenericConnection<C, S>
[src]
pub async fn validate_server<'_>(&'_ self) -> Result<(), ClientError>
[src]
Validate the server at given arango url
Cast failure::Error
if
- Connection failed
- SERVER header in response header is not
ArangoDB
or empty
pub fn get_url(&self) -> &Url
[src]
Get url for remote arangoDB server.
pub fn get_session(&self) -> Arc<C>
[src]
Get HTTP session.
Users can use this method to get a authorized session to access arbitrary path on arangoDB Server.
TODO This method should only be public in this crate when all features are implemented.
pub async fn db<'_, '_, '_>(
&'_ self,
name: &'_ str
) -> Result<Database<'_, C>, ClientError>
[src]
&'_ self,
name: &'_ str
) -> Result<Database<'_, C>, ClientError>
pub async fn accessible_databases<'_>(
&'_ self
) -> Result<HashMap<String, Permission>, ClientError>
[src]
&'_ self
) -> Result<HashMap<String, Permission>, ClientError>
Get a list of accessible database
This function uses the API that is used to retrieve a list of all databases the current user can access.
Note
this function would make a request to arango server.
impl<C: ClientExt> GenericConnection<C, Normal>
[src]
pub async fn establish_without_auth<T: Into<String>>(
arango_url: T
) -> Result<GenericConnection<C, Normal>, ClientError>
[src]
arango_url: T
) -> Result<GenericConnection<C, Normal>, ClientError>
Establish connection to ArangoDB sever without Authentication.
The target server MUST DISABLE authentication for all requests, which should only used for test purpose.
Disable authentication means all operations are performed by root user.
Example:
use arangors::Connection; let conn = Connection::establish_without_auth("http://localhost:8529").await.unwrap();
pub async fn establish_basic_auth<'_, '_, '_>(
arango_url: &'_ str,
username: &'_ str,
password: &'_ str
) -> Result<GenericConnection<C, Normal>, ClientError>
[src]
arango_url: &'_ str,
username: &'_ str,
password: &'_ str
) -> Result<GenericConnection<C, Normal>, ClientError>
Establish connection to ArangoDB sever with basic auth.
Example:
use arangors::Connection; let conn = Connection::establish_basic_auth("http://localhost:8529", "username", "password") .await .unwrap();
pub async fn establish_jwt<'_, '_, '_>(
arango_url: &'_ str,
username: &'_ str,
password: &'_ str
) -> Result<GenericConnection<C, Normal>, ClientError>
[src]
arango_url: &'_ str,
username: &'_ str,
password: &'_ str
) -> Result<GenericConnection<C, Normal>, ClientError>
Establish connection to ArangoDB sever with jwt authentication.
Prefered way to interact with arangoDB server.
JWT token expires after 1 month.
Example:
use arangors::Connection; let conn = Connection::establish_jwt("http://localhost:8529", "username", "password") .await .unwrap();
pub async fn create_database<'_, '_, '_>(
&'_ self,
name: &'_ str
) -> Result<Database<'_, C>, ClientError>
[src]
&'_ self,
name: &'_ str
) -> Result<Database<'_, C>, ClientError>
Create a database via HTTP request and add it into self.databases
.
If creation fails, an Error is cast. Otherwise, a bool is returned to indicate whether the database is correctly created.
Example
use arangors::Connection; let conn = Connection::establish_jwt("http://localhost:8529", "root", "KWNngteTps7XjrNv") .await .unwrap(); let result = conn.create_database("new_db").await.unwrap(); println!("{:?}", result); let result = conn.drop_database("new_db").await.unwrap(); println!("{:?}", result);
TODO tweak options on creating database
Note
this function would make a request to arango server.
pub async fn drop_database<'_, '_>(
&'_ self,
name: &'_ str
) -> Result<(), ClientError>
[src]
&'_ self,
name: &'_ str
) -> Result<(), ClientError>
pub async fn into_admin(
self
) -> Result<GenericConnection<C, Admin>, ClientError>
[src]
self
) -> Result<GenericConnection<C, Admin>, ClientError>
impl<C: ClientExt> GenericConnection<C, Admin>
[src]
pub fn into_normal(self) -> GenericConnection<C, Normal>
[src]
Trait Implementations
impl<C: Clone + ClientExt, S: Clone> Clone for GenericConnection<C, S>
[src]
fn clone(&self) -> GenericConnection<C, S>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<C: Debug + ClientExt, S: Debug> Debug for GenericConnection<C, S>
[src]
impl<C: ClientExt> From<GenericConnection<C, Admin>> for GenericConnection<C, Normal>
[src]
fn from(conn: GenericConnection<C, Admin>) -> GenericConnection<C, Normal>
[src]
impl<C: ClientExt> From<GenericConnection<C, Normal>> for GenericConnection<C, Admin>
[src]
fn from(conn: GenericConnection<C, Normal>) -> GenericConnection<C, Admin>
[src]
Auto Trait Implementations
impl<C, S> RefUnwindSafe for GenericConnection<C, S> where
C: RefUnwindSafe,
S: RefUnwindSafe,
C: RefUnwindSafe,
S: RefUnwindSafe,
impl<C, S> Send for GenericConnection<C, S> where
C: Send,
S: Send,
C: Send,
S: Send,
impl<C, S> Sync for GenericConnection<C, S> where
C: Send,
S: Sync,
C: Send,
S: Sync,
impl<C, S> Unpin for GenericConnection<C, S> where
S: Unpin,
S: Unpin,
impl<C, S> UnwindSafe for GenericConnection<C, S> where
C: RefUnwindSafe,
S: UnwindSafe,
C: RefUnwindSafe,
S: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,