arangors_graph_exporter/
load.rs

1use crate::aql_graph_loader::{AqlGraphLoader, AqlQuery, DataItem};
2use crate::config::{DataLoadConfiguration, DatabaseConfiguration};
3use crate::errors::GraphLoaderError;
4use crate::graph_loader::{CollectionInfo, GraphLoader};
5
6// User-facing functions to load graphs
7pub async fn load_named_graph(
8    db_config: DatabaseConfiguration,
9    load_config: DataLoadConfiguration,
10    graph_name: String,
11    vertex_global_fields: Option<Vec<String>>,
12    edge_global_fields: Option<Vec<String>>,
13) -> Result<GraphLoader, GraphLoaderError> {
14    GraphLoader::new_named(
15        db_config,
16        load_config,
17        graph_name,
18        vertex_global_fields,
19        edge_global_fields,
20    )
21    .await
22}
23
24pub async fn load_custom_graph(
25    db_config: DatabaseConfiguration,
26    load_config: DataLoadConfiguration,
27    vertex_collections: Vec<CollectionInfo>,
28    edge_collections: Vec<CollectionInfo>,
29) -> Result<GraphLoader, GraphLoaderError> {
30    GraphLoader::new_custom(db_config, load_config, vertex_collections, edge_collections).await
31}
32
33pub fn load_aql_graph(
34    db_config: DatabaseConfiguration,
35    batch_size: u64,
36    vertex_attributes: Vec<DataItem>,
37    edge_attributes: Vec<DataItem>,
38    queries: Vec<Vec<AqlQuery>>,
39) -> Result<AqlGraphLoader, GraphLoaderError> {
40    AqlGraphLoader::new(
41        db_config,
42        batch_size,
43        vertex_attributes,
44        edge_attributes,
45        queries,
46    )
47}