Struct rincon_session::GraphSession
[−]
[src]
pub struct GraphSession<C> { /* fields omitted */ }
A session for operating with a specific graph.
Methods
impl<C> GraphSession<C> where
C: 'static + Connector,
[src]
C: 'static + Connector,
pub fn database_name(&self) -> &str
[src]
Returns the name of the database this graph is located in.
pub fn name(&self) -> &str
[src]
Returns the name of the graph this GraphSession
operates with.
pub fn entity(&self) -> Option<&Graph>
[src]
Returns the Graph
entity this GraphSession
operates with.
It returns Some(&Graph)
when this session holds a loaded graph entity
or None
otherwise.
If the graph entity is not loaded the load()
function can be used
to get a session with a loaded graph entity.
pub fn unwrap(self) -> Entity<Graph>
[src]
Unwraps the graph entity out of this session which is either the name
of the graph or a Graph
instance.
pub fn is_entity(&self) -> bool
[src]
Returns whether this session holds a loaded graph entity.
It returns true if this session holds the graph entity or false
otherwise. If this function returns true the entity()
function will
return Some(&Graph)
otherwise that function returns None
.
pub fn fetch(self) -> Result<GraphSession<C>>
[src]
Fetches the entity of the graph represented by this session and returns
a new GraphSession
with the entity set in the session.
pub fn drop(self) -> Result<bool>
[src]
Drops the graph that is represented by this session.
Returns true if the graph has been dropped successfully.
After calling this function the associated GraphSession
is no longer
valid.
pub fn add_vertex_collection<N>(
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
[src]
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
Adds a vertex collection of the given name to the set of collections of the graph represented by this session. If the collection does not exist if will be created.
It returns a new GraphSession
representing the updated graph.
pub fn remove_vertex_collection<N>(
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
[src]
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
Removes the vertex collection of the given name from the graph represented by this session and optionally deletes the collection if it is not used in any other graph.
It returns a new GraphSession
representing the updated graph.
pub fn list_vertex_collections(&self) -> Result<Vec<String>>
[src]
List all vertex collections used in the graph represented by this session.
pub fn use_vertex_collection<N>(
&self,
collection_name: N
) -> VertexCollectionSession<C> where
N: Into<String>,
[src]
&self,
collection_name: N
) -> VertexCollectionSession<C> where
N: Into<String>,
Returns a new VertexCollectionSession
for the vertex collection of the
given name.
pub fn add_edge_definition<N, From, To>(
self,
collection_name: N,
from: From,
to: To
) -> Result<GraphSession<C>> where
N: Into<String>,
From: IntoIterator<Item = String>,
To: IntoIterator<Item = String>,
[src]
self,
collection_name: N,
from: From,
to: To
) -> Result<GraphSession<C>> where
N: Into<String>,
From: IntoIterator<Item = String>,
To: IntoIterator<Item = String>,
Adds an edge definition to the graph represented by this session.
Arguments
collection_name
: The name of the edge collectionfrom
: One or many vertex collections that can contain source verticesto
: One or many vertex collections that can contain target vertices
It returns a new GraphSession
representing the updated graph.
pub fn remove_edge_definition<N>(
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
[src]
self,
collection_name: N
) -> Result<GraphSession<C>> where
N: Into<String>,
Removes the edge definition of the given name from the graph represented by this session.
This will only remove the edge collection, the vertex collections remain untouched.
It returns a new GraphSession
representing the updated graph.
pub fn list_edge_definitions(&self) -> Result<Vec<String>>
[src]
List all edge collections used in the graph represented by this session.
pub fn use_edge_collection<N>(
&self,
collection_name: N
) -> EdgeCollectionSession<C> where
N: Into<String>,
[src]
&self,
collection_name: N
) -> EdgeCollectionSession<C> where
N: Into<String>,
Returns a new EdgeCollectionSession
for the edge collection of the
given name.