pub struct Database<C: ClientExt> { /* private fields */ }
Implementations§
source§impl<'a, C: ClientExt> Database<C>
impl<'a, C: ClientExt> Database<C>
sourcepub async fn accessible_collections(&self) -> Result<Vec<Info>, ClientError>
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.
pub fn url(&self) -> &Url
pub fn name(&self) -> &str
pub fn session(&self) -> Arc<C>
sourcepub async fn collection(&self, name: &str) -> Result<Collection<C>, ClientError>
pub async fn collection(&self, name: &str) -> Result<Collection<C>, ClientError>
sourcepub async fn create_collection_with_options<'f>(
&self,
options: CreateOptions<'f>,
parameters: CreateParameters
) -> Result<Collection<C>, ClientError>
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.
sourcepub async fn create_collection(
&self,
name: &str
) -> Result<Collection<C>, ClientError>
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.
pub async fn create_edge_collection( &self, name: &str ) -> Result<Collection<C>, ClientError>
sourcepub async fn drop_collection(&self, name: &str) -> Result<String, ClientError>
pub async fn drop_collection(&self, name: &str) -> Result<String, ClientError>
sourcepub async fn arango_version(&self) -> Result<Version, ClientError>
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.
sourcepub async fn info(&self) -> Result<DatabaseDetails, ClientError>
pub async fn info(&self) -> Result<DatabaseDetails, ClientError>
sourcepub async fn aql_query_batch<R>(
&self,
aql: AqlQuery<'_>
) -> Result<Cursor<R>, ClientError>where
R: DeserializeOwned,
pub async fn aql_query_batch<R>( &self, aql: AqlQuery<'_> ) -> Result<Cursor<R>, ClientError>where R: DeserializeOwned,
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.
sourcepub async fn aql_next_batch<R>(
&self,
cursor_id: &str
) -> Result<Cursor<R>, ClientError>where
R: DeserializeOwned,
pub async fn aql_next_batch<R>( &self, cursor_id: &str ) -> Result<Cursor<R>, ClientError>where R: DeserializeOwned,
sourcepub async fn aql_query<R>(
&self,
aql: AqlQuery<'_>
) -> Result<Vec<R>, ClientError>where
R: DeserializeOwned,
pub async fn aql_query<R>( &self, aql: AqlQuery<'_> ) -> Result<Vec<R>, ClientError>where R: DeserializeOwned,
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.
sourcepub async fn aql_str<R>(&self, query: &str) -> Result<Vec<R>, ClientError>where
R: DeserializeOwned,
pub async fn aql_str<R>(&self, query: &str) -> Result<Vec<R>, ClientError>where R: DeserializeOwned,
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.
sourcepub async fn aql_bind_vars<R>(
&self,
query: &str,
bind_vars: HashMap<&str, Value>
) -> Result<Vec<R>, ClientError>where
R: DeserializeOwned,
pub async fn aql_bind_vars<R>( &self, query: &str, bind_vars: HashMap<&str, Value> ) -> Result<Vec<R>, ClientError>where R: DeserializeOwned,
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.
sourcepub async fn create_index(
&self,
collection: &str,
index: &Index
) -> Result<Index, ClientError>
pub async fn create_index( &self, collection: &str, index: &Index ) -> Result<Index, ClientError>
sourcepub async fn indexes(
&self,
collection: &str
) -> Result<IndexCollection, ClientError>
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.
sourcepub async fn delete_index(
&self,
id: &str
) -> Result<DeleteIndexResponse, ClientError>
pub async fn delete_index( &self, id: &str ) -> Result<DeleteIndexResponse, ClientError>
sourcepub async fn create_graph(
&self,
graph: Graph,
wait_for_sync: bool
) -> Result<Graph, ClientError>
pub async fn create_graph( &self, graph: Graph, wait_for_sync: bool ) -> Result<Graph, ClientError>
sourcepub async fn graphs(&self) -> Result<GraphCollection, ClientError>
pub async fn graphs(&self) -> Result<GraphCollection, ClientError>
sourcepub async fn drop_graph(
&self,
name: &str,
drop_collections: bool
) -> Result<(), ClientError>
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 dropdrop_collections
- if set totrue
, 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.
sourcepub async fn list_transactions(
&self
) -> Result<Vec<TransactionState>, ClientError>
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.
sourcepub async fn begin_transaction(
&self,
transaction_settings: TransactionSettings
) -> Result<Transaction<C>, ClientError>
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.
sourcepub async fn list_views(&self) -> Result<Vec<ViewDescription>, ClientError>
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.
sourcepub async fn create_view(
&self,
view_options: ViewOptions
) -> Result<View, ClientError>
pub async fn create_view( &self, view_options: ViewOptions ) -> Result<View, ClientError>
sourcepub async fn view(
&self,
view_name: &str
) -> Result<ViewDescription, ClientError>
pub async fn view( &self, view_name: &str ) -> Result<ViewDescription, ClientError>
sourcepub async fn view_properties(
&self,
view_name: &str
) -> Result<ArangoSearchViewProperties, ClientError>
pub async fn view_properties( &self, view_name: &str ) -> Result<ArangoSearchViewProperties, ClientError>
sourcepub async fn replace_view_properties(
&self,
view_name: &str,
properties: ArangoSearchViewPropertiesOptions
) -> Result<View, ClientError>
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.
sourcepub async fn update_view_properties(
&self,
view_name: &str,
properties: ArangoSearchViewPropertiesOptions
) -> Result<View, ClientError>
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.
pub async fn list_analyzers(&self) -> Result<Vec<AnalyzerInfo>, ClientError>
sourcepub async fn create_analyzer(
&self,
analyzer: AnalyzerInfo
) -> Result<AnalyzerInfo, ClientError>
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.
sourcepub async fn analyzer(
&self,
analyzer_name: &str
) -> Result<AnalyzerInfo, ClientError>
pub async fn analyzer( &self, analyzer_name: &str ) -> Result<AnalyzerInfo, ClientError>
sourcepub async fn drop_analyzer(
&self,
analyzer_name: &str
) -> Result<AnalyzerDescription, ClientError>
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.
sourcepub async fn users(&self) -> Result<Vec<User>, ClientError>
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.