Struct arangors::database::Database

source ·
pub struct Database<C: ClientExt> { /* private fields */ }

Implementations§

source§

impl<'a, C: ClientExt> Database<C>

source

pub async fn accessible_collections(&self) -> Result<Vec<Info>, ClientError>

Retrieve all collections of this database.

§Note

this function would make a request to arango server.

source

pub fn url(&self) -> &Url

source

pub fn name(&self) -> &str

source

pub fn session(&self) -> Arc<C>

source

pub async fn collection(&self, name: &str) -> Result<Collection<C>, ClientError>

Get collection object with name.

§Note

this function would make a request to arango server.

source

pub async fn create_collection_with_options<'f>( &self, options: CreateOptions<'f>, parameters: CreateParameters, ) -> Result<Collection<C>, ClientError>

Create a collection via HTTP request with options.

Return a collection object if success.

§Note

this function would make a request to arango server.

source

pub async fn create_collection( &self, name: &str, ) -> Result<Collection<C>, ClientError>

Create a collection via HTTP request.

Return a collection object if success.

§Note

this function would make a request to arango server.

source

pub async fn create_edge_collection( &self, name: &str, ) -> Result<Collection<C>, ClientError>

source

pub async fn drop_collection(&self, name: &str) -> Result<String, ClientError>

Drops a collection

§Note

this function would make a request to arango server.

source

pub async fn arango_version(&self) -> Result<Version, ClientError>

Get the version remote arango database server

§Note

this function would make a request to arango server.

source

pub async fn info(&self) -> Result<DatabaseDetails, ClientError>

Get information of current database.

§Note

this function would make a request to arango server.

source

pub async fn aql_query_batch<R>( &self, aql: AqlQuery<'_>, ) -> Result<Cursor<R>, ClientError>

Execute aql query, return a cursor if succeed. The major advantage of batch query is that cursors contain more information and stats about the AQL query, and users can fetch results in batch to save memory resources on clients.

§Note

this function would make a request to arango server.

source

pub async fn aql_next_batch<R>( &self, cursor_id: &str, ) -> Result<Cursor<R>, ClientError>

Get next batch given the cursor id.

§Note

this function would make a request to arango server.

source

pub async fn aql_query<R>( &self, aql: AqlQuery<'_>, ) -> Result<Vec<R>, ClientError>

Execute AQL query fetch all results.

DO NOT do this when the count of results is too large that network or memory resources cannot afford.

DO NOT set a small batch size, otherwise clients will have to make many HTTP requests.

§Note

this function would make a request to arango server.

source

pub async fn aql_str<R>(&self, query: &str) -> Result<Vec<R>, ClientError>

Similar to aql_query, except that this method only accept a string of AQL query.

§Note

this function would make a request to arango server.

source

pub async fn aql_bind_vars<R>( &self, query: &str, bind_vars: HashMap<&str, Value>, ) -> Result<Vec<R>, ClientError>

Similar to aql_query, except that this method only accept a string of AQL query, with additional bind vars.

§Note

this function would make a request to arango server.

source

pub async fn create_index( &self, collection: &str, index: &Index, ) -> Result<Index, ClientError>

Create a new index on a collection.

§Note

this function would make a request to arango server.

source

pub async fn index(&self, id: &str) -> Result<Index, ClientError>

Retrieve an index by id

§Note

this function would make a request to arango server.

source

pub async fn indexes( &self, collection: &str, ) -> Result<IndexCollection, ClientError>

Retrieve a list of indexes for a collection.

§Note

this function would make a request to arango server.

source

pub async fn delete_index( &self, id: &str, ) -> Result<DeleteIndexResponse, ClientError>

Delete an index by id.

§Note

this function would make a request to arango server.

source

pub async fn create_graph( &self, graph: Graph, wait_for_sync: bool, ) -> Result<Graph, ClientError>

Create a new graph in the graph module.

§Arguments
  • graph - The graph object to create, its name must be unique.
  • wait_for_sync - define if the request should wait until everything is synced to disc.
§Note

this function would make a request to arango server.

source

pub async fn graph(&self, name: &str) -> Result<Graph, ClientError>

Retrieve an graph by name

§Note

this function would make a request to arango server.

source

pub async fn graphs(&self) -> Result<GraphCollection, ClientError>

Retrieve the list of created graphs.

§Note

this function would make a request to arango server.

source

pub async fn drop_graph( &self, name: &str, drop_collections: bool, ) -> Result<(), ClientError>

Drops an existing graph object by name. Optionally all collections not used by other graphs can be dropped as well.

§Arguments
  • name - The name of the graph to drop
  • drop_collections- if set to true, drops collections of this graph as well. Collections will only be dropped if they are not used in other graphs.
§Note

this function would make a request to arango server.

source

pub async fn list_transactions( &self, ) -> Result<Vec<TransactionState>, ClientError>

Return the currently running server-side transactions

§Note

this function would make a request to arango server.

source

pub async fn begin_transaction( &self, transaction_settings: TransactionSettings, ) -> Result<Transaction<C>, ClientError>

Begin a server-side transaction, the transaction settings should specify at least collections to be updated through the write list

§Note

this function would make a request to arango server.

source

pub async fn list_views(&self) -> Result<Vec<ViewDescription>, ClientError>

Returns an object containing a listing of all Views in a database, regardless of their typ

§Note

this function would make a request to arango server.

source

pub async fn create_view( &self, view_options: ViewOptions, ) -> Result<View, ClientError>

Creates an ArangoSearch View

§Note

this function would make a request to arango server.

source

pub async fn view( &self, view_name: &str, ) -> Result<ViewDescription, ClientError>

Return information about a View

§Note

this function would make a request to arango server.

source

pub async fn view_properties( &self, view_name: &str, ) -> Result<ArangoSearchViewProperties, ClientError>

Read properties of a View

§Note

this function would make a request to arango server.

source

pub async fn replace_view_properties( &self, view_name: &str, properties: ArangoSearchViewPropertiesOptions, ) -> Result<View, ClientError>

Changes all the properties of an ArangoSearch

§Note

this function would make a request to arango server.

source

pub async fn update_view_properties( &self, view_name: &str, properties: ArangoSearchViewPropertiesOptions, ) -> Result<View, ClientError>

Partially changes properties of an ArangoSearch View

§Note

this function would make a request to arango server.

source

pub async fn drop_view(&self, view_name: &str) -> Result<bool, ClientError>

Drops the View identified by view-name.

§Note

this function would make a request to arango server.

source

pub async fn list_analyzers(&self) -> Result<Vec<AnalyzerInfo>, ClientError>

source

pub async fn create_analyzer( &self, analyzer: AnalyzerInfo, ) -> Result<AnalyzerInfo, ClientError>

Create an Analyzer with the supplied definition

§Note

this function would make a request to arango server.

source

pub async fn analyzer( &self, analyzer_name: &str, ) -> Result<AnalyzerInfo, ClientError>

Return the Analyzer definition

§Note

this function would make a request to arango server.

source

pub async fn drop_analyzer( &self, analyzer_name: &str, ) -> Result<AnalyzerDescription, ClientError>

Removes an Analyzer configuration identified by analyzer_name.

§Note

this function would make a request to arango server.

source

pub async fn users(&self) -> Result<Vec<User>, ClientError>

List available users

Fetches data about all users. You need the Administrate server access level in order to execute this REST call. Otherwise, you will only get information about yourself.

§Note

this function would make a request to arango server.

source

pub async fn create_user(&self, user: User) -> Result<User, ClientError>

Create User

§Note

this function would make a request to arango server.

source

pub async fn update_user( &self, username: String, user: User, ) -> Result<User, ClientError>

Create User

§Note

this function would make a request to arango server.

source

pub async fn delete_user(&self, username: String) -> Result<(), ClientError>

Delete User

§Note

this function would make a request to arango server.

source

pub async fn user_databases( &self, username: String, full: bool, ) -> Result<UserDatabasesGetResponse, ClientError>

Get user-accessible databases

§Note

this function would make a request to arango server.

source

pub async fn user_db_access_level( &self, username: String, db_name: String, ) -> Result<UserDatabasesGetResponse, ClientError>

Get user-accessible databases

§Note

this function would make a request to arango server.

source

pub async fn user_db_access_put( &self, username: String, db_name: String, access_level: UserAccessLevel, ) -> Result<Value, ClientError>

Set user’s databases access level

§Note

this function would make a request to arango server.

source

pub async fn user_db_collection_access( &self, username: String, db_name: String, collection: String, ) -> Result<Value, ClientError>

Set user’s databases access level

§Note

this function would make a request to arango server.

source

pub async fn user_db_collection_access_put( &self, username: String, db_name: String, collection: String, access_level: UserAccessLevel, ) -> Result<Value, ClientError>

Set user’s databases access level

§Note

this function would make a request to arango server.

Trait Implementations§

source§

impl<C: Clone + ClientExt> Clone for Database<C>

source§

fn clone(&self) -> Database<C>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<C: Debug + ClientExt> Debug for Database<C>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<C> Freeze for Database<C>

§

impl<C> RefUnwindSafe for Database<C>
where C: RefUnwindSafe,

§

impl<C> Send for Database<C>
where C: Send,

§

impl<C> Sync for Database<C>
where C: Send,

§

impl<C> Unpin for Database<C>

§

impl<C> UnwindSafe for Database<C>
where C: RefUnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more