1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
use crate::{
graph::{
input::{
CreateConfig, CreateEdgeDefConfig, CreateVertexCollConfig, CreateVertexConfig,
DeleteConfig, DeleteEdgeDefConfig, DeleteVertexCollConfig, DeleteVertexConfig,
EdgeCreateConfig, EdgeDeleteConfig, EdgeReadConfig, EdgeReplaceConfig,
EdgeUpdateConfig, ReadConfig, ReadEdgeDefsConfig, ReadVertexCollsConfig,
ReadVertexConfig, ReplaceEdgeDefConfig, UpdateVertexConfig,
},
output::{
CreateEdge, DeleteEdge, DeleteVertexMeta, EdgesMeta, GraphMeta, List, ReadEdge,
ReadVertexMeta, ReplaceEdge, UpdateEdge, UpdateVertexMeta, VertexColls, VertexMeta,
},
},
ArangoResult,
};
use async_trait::async_trait;
use serde::Serialize;
#[async_trait]
pub trait Graph {
async fn list(&self) -> ArangoResult<List>;
async fn create(&self, config: CreateConfig) -> ArangoResult<GraphMeta>;
async fn read(&self, config: ReadConfig) -> ArangoResult<GraphMeta>;
async fn delete(&self, config: DeleteConfig) -> ArangoResult<()>;
async fn create_edge_def(&self, config: CreateEdgeDefConfig) -> ArangoResult<GraphMeta>;
async fn read_edge_defs(&self, config: ReadEdgeDefsConfig) -> ArangoResult<EdgesMeta>;
async fn delete_edge_def(&self, config: DeleteEdgeDefConfig) -> ArangoResult<GraphMeta>;
async fn replace_edge_def(&self, config: ReplaceEdgeDefConfig) -> ArangoResult<GraphMeta>;
async fn create_edge(&self, config: EdgeCreateConfig) -> ArangoResult<CreateEdge>;
async fn delete_edge(&self, config: EdgeDeleteConfig) -> ArangoResult<DeleteEdge>;
async fn read_edge(&self, config: EdgeReadConfig) -> ArangoResult<ReadEdge>;
async fn update_edge<T>(&self, config: EdgeUpdateConfig<T>) -> ArangoResult<UpdateEdge>
where
T: Serialize + Send + Sync;
async fn replace_edge<T>(&self, config: EdgeReplaceConfig<T>) -> ArangoResult<ReplaceEdge>
where
T: Serialize + Send + Sync;
async fn read_vertex_colls(&self, config: ReadVertexCollsConfig) -> ArangoResult<VertexColls>;
async fn create_vertex_coll(&self, config: CreateVertexCollConfig) -> ArangoResult<GraphMeta>;
async fn delete_vertex_coll(&self, config: DeleteVertexCollConfig) -> ArangoResult<GraphMeta>;
async fn create_vertex<T>(&self, config: CreateVertexConfig<T>) -> ArangoResult<VertexMeta>
where
T: Serialize + Send + Sync;
async fn read_vertex(&self, config: ReadVertexConfig) -> ArangoResult<ReadVertexMeta>;
async fn delete_vertex(&self, config: DeleteVertexConfig) -> ArangoResult<DeleteVertexMeta>;
async fn update_vertex<T>(
&self,
config: UpdateVertexConfig<T>,
) -> ArangoResult<UpdateVertexMeta>
where
T: Serialize + Send + Sync;
async fn replace_vertex<T>(
&self,
config: UpdateVertexConfig<T>,
) -> ArangoResult<UpdateVertexMeta>
where
T: Serialize + Send + Sync;
}