Trait indradb::Transaction

source ·
pub trait Transaction {
Show 15 methods fn create_vertex(&self, vertex: &Vertex) -> Result<bool>; fn get_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<Vec<Vertex>>; fn delete_vertices<Q: Into<VertexQuery>>(&self, q: Q) -> Result<()>; fn get_vertex_count(&self) -> Result<u64>; fn create_edge(&self, key: &EdgeKey) -> Result<bool>; fn get_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<Vec<Edge>>; fn delete_edges<Q: Into<EdgeQuery>>(&self, q: Q) -> Result<()>; fn get_edge_count(
        &self,
        id: Uuid,
        t: Option<&Type>,
        direction: EdgeDirection
    ) -> Result<u64>; fn get_vertex_properties(
        &self,
        q: VertexPropertyQuery
    ) -> Result<Vec<VertexProperty>>; fn set_vertex_properties(
        &self,
        q: VertexPropertyQuery,
        value: &JsonValue
    ) -> Result<()>; fn delete_vertex_properties(&self, q: VertexPropertyQuery) -> Result<()>; fn get_edge_properties(
        &self,
        q: EdgePropertyQuery
    ) -> Result<Vec<EdgeProperty>>; fn set_edge_properties(
        &self,
        q: EdgePropertyQuery,
        value: &JsonValue
    ) -> Result<()>; fn delete_edge_properties(&self, q: EdgePropertyQuery) -> Result<()>; fn create_vertex_from_type(&self, t: Type) -> Result<Uuid> { ... }
}
Expand description

Specifies a transaction implementation, which are returned by datastores. All datastore manipulations are done through transactions. Despite the name, different datastore implementations carry different guarantees. Depending on the implementation, it may not be possible to rollback the changes on error. See the documentation of individual implementations for details. Transactions are automatically committed on drop. Transactions should be designed to not fail on commit; i.e. errors should occur when a method is actually called instead.

Required Methods

Creates a new vertex. Returns whether the vertex was successfully created - if this is false, it’s because a vertex with the same UUID already exists.

Arguments
  • vertex: The vertex to create.

Gets a range of vertices specified by a query.

Arguments
  • q - The query to run.

Deletes existing vertices specified by a query.

Arguments
  • q - The query to run.

Gets the number of vertices in the datastore..

Creates a new edge. If the edge already exists, this will update it with a new update datetime. Returns whether the edge was successfully created - if this is false, it’s because one of the specified vertices is missing.

Arguments
  • key: The edge to create.

Gets a range of edges specified by a query.

Arguments
  • q - The query to run.

Deletes a set of edges specified by a query.

Arguments
  • q - The query to run.

Gets the number of edges associated with a vertex.

Arguments
  • id - The id of the vertex.
  • t - Only get the count for a specified edge type.
  • direction: The direction of edges to get.

Gets vertex properties.

Arguments
  • q - The query to run.
  • name - The property name.

Sets a vertex properties.

Arguments
  • q - The query to run.
  • name - The property name.
  • value - The property value.

Deletes vertex properties.

Arguments
  • q - The query to run.
  • name - The property name.

Gets edge properties.

Arguments
  • q - The query to run.
  • name - The property name.

Sets edge properties.

Arguments
  • q - The query to run.
  • name - The property name.
  • value - The property value.

Deletes edge properties.

Arguments
  • q - The query to run.
  • name - The property name.

Provided Methods

Creates a new vertex with just a type specification. As opposed to create_vertex, this is used when you do not want to manually specify the vertex’s UUID. Returns the new vertex’s UUID.

Arguments
  • t: The type of the vertex to create.

Implementors