Skip to content

Commit

Permalink
feat: User Management (#110)
Browse files Browse the repository at this point in the history
* user crud operations
* implementation for REST API endpoints `user/{user}/database/{dbname}` and `user/{user}/database/{dbname}/{collection}`
  • Loading branch information
sharwinbobde committed Aug 25, 2023
1 parent 481c82b commit 283d715
Show file tree
Hide file tree
Showing 21 changed files with 643 additions and 99 deletions.
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ format_code_in_doc_comments = true
normalize_doc_attributes = true
wrap_comments = true
format_strings = true
merge_imports = true
imports_granularity="Crate"
6 changes: 4 additions & 2 deletions examples/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

use anyhow::Error;

use arangors::analyzer::{AnalyzerCase, AnalyzerFeature, AnalyzerInfo, NormAnalyzerProperties};
use arangors::Connection;
use arangors::{
analyzer::{AnalyzerCase, AnalyzerFeature, AnalyzerInfo, NormAnalyzerProperties},
Connection,
};
use std::collections::HashMap;

const URL: &str = "http://localhost:8529";
Expand Down
3 changes: 1 addition & 2 deletions examples/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@
#![allow(unused_parens)]

use anyhow::Error;
use arangors::Document;
use arangors::{
transaction::{TransactionCollections, TransactionSettings},
Connection,
Connection, Document,
};
use log::info;
use serde_json::{json, Value};
Expand Down
6 changes: 4 additions & 2 deletions examples/view.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

use anyhow::Error;

use arangors::view::{ArangoSearchViewLink, ArangoSearchViewPropertiesOptions, ViewOptions};
use arangors::Connection;
use arangors::{
view::{ArangoSearchViewLink, ArangoSearchViewPropertiesOptions, ViewOptions},
Connection,
};
use std::collections::HashMap;

const URL: &str = "http://localhost:8529";
Expand Down
15 changes: 9 additions & 6 deletions src/analyzer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ pub enum GeoJsonType {
#[derive(Clone, Debug, Serialize, Deserialize, TypedBuilder, PartialEq)]
#[builder(doc)]
pub struct DelimiterAnalyzerProperties {
/// The value will be used as delimiter to split text into tokens as specified
/// in RFC 4180, without starting new records on newlines.
/// The value will be used as delimiter to split text into tokens as
/// specified in RFC 4180, without starting new records on newlines.
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub delimiter: Option<String>,
Expand Down Expand Up @@ -106,7 +106,8 @@ pub struct TextAnalyzerProperties {
#[builder(default, setter(strip_option))]
pub stopwords: Option<Vec<String>>,

/// Path with a `language` sub-directory containing files with words to omit.
/// Path with a `language` sub-directory containing files with words to
/// omit.
///
/// Defaults to the path specified in the server-side environment variable
/// IRESEARCH_TEXT_STOPWORD_PATH` or the current working directory of the
Expand All @@ -125,7 +126,8 @@ pub struct TextAnalyzerProperties {
#[derive(Clone, Debug, Serialize, Deserialize, TypedBuilder, PartialEq)]
#[builder(doc)]
pub struct GeoJsonAnalyzerProperties {
/// Whether to index all GeoJSON geometry types, just the centroid, or just points
/// Whether to index all GeoJSON geometry types, just the centroid, or just
/// points
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
pub r#type: Option<GeoJsonType>,
Expand Down Expand Up @@ -234,8 +236,9 @@ pub struct AnalyzerDescription {
pub name: String,
}

//these are the exact same analyzer types , but customized to be used in a pipeline analyzer
//since in pipeline analyzers `name` is not required for each sub-analyzer, the name filed is deleted
//these are the exact same analyzer types , but customized to be used in a
// pipeline analyzer since in pipeline analyzers `name` is not required for each
// sub-analyzer, the name filed is deleted
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq)]
#[serde(rename_all = "camelCase", tag = "type")]
pub enum PipelineAnalyzers {
Expand Down
10 changes: 6 additions & 4 deletions src/collection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,10 @@ impl<'a, C: ClientExt> Collection<C> {
/// This call does not delete any documents. You can use the collection
/// afterwards; in which case it will be loaded into memory, again.
///
/// **Warning**: The unload function is deprecated from version 3.8.0 onwards and is a no-op
/// from version 3.9.0 onwards. It should no longer be used, as it may be removed
/// in a future version of ArangoDB.
/// **Warning**: The unload function is deprecated from version 3.8.0
/// onwards and is a no-op from version 3.9.0 onwards. It should no
/// longer be used, as it may be removed in a future version of
/// ArangoDB.
///
/// # Note
/// this function would make a request to arango server.
Expand Down Expand Up @@ -772,7 +773,8 @@ impl<'a, C: ClientExt> Collection<C> {
Ok(resp)
}

/// Returns a new Collection with its `session` updated with the transaction id
/// Returns a new Collection with its `session` updated with the transaction
/// id
pub fn clone_with_transaction(&self, transaction_id: String) -> Result<Self, ClientError> {
let mut session = (*self.session).clone();
session
Expand Down
3 changes: 2 additions & 1 deletion src/connection/options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ use std::collections::HashMap;
#[cfg(feature = "cluster")]
pub struct CreateDatabaseOptions {
/// The sharding method to use for new collections in this database.
/// Valid values are: “”, “flexible”, or “single”. The first two are equivalent
/// Valid values are: “”, “flexible”, or “single”. The first two are
/// equivalent
#[serde(skip_serializing_if = "Option::is_none")]
#[builder(default, setter(strip_option))]
sharding: Option<String>,
Expand Down
Loading

0 comments on commit 283d715

Please sign in to comment.