pub struct Database<D: Datastore> {
pub datastore: D,
}
Expand description
The IndraDB database.
This contains all of the logic shared across implementations, e.g. query handling. Underlying it (as a generic argument) are datastores, which contain implementation-specific logic.
As an IndraDB end-user, you should interact with this rather than datastores.
Fields§
§datastore: D
Implementations§
Source§impl<D: Datastore> Database<D>
impl<D: Datastore> Database<D>
Sourcepub fn sync(&self) -> Result<()>
pub fn sync(&self) -> Result<()>
Syncs persisted content. Depending on the datastore implementation, this has different meanings - including potentially being a no-op.
Sourcepub fn create_vertex(&self, vertex: &Vertex) -> Result<bool>
pub fn create_vertex(&self, vertex: &Vertex) -> Result<bool>
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.
Sourcepub fn create_vertex_from_type(&self, t: Identifier) -> Result<Uuid>
pub fn create_vertex_from_type(&self, t: Identifier) -> Result<Uuid>
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.
Sourcepub fn create_edge(&self, edge: &Edge) -> Result<bool>
pub fn create_edge(&self, edge: &Edge) -> Result<bool>
Creates a new edge. Returns whether the edge was successfully created - if this is false, it’s because one of the specified vertices is missing.
§Arguments
edge
: The edge to create.
Sourcepub fn set_properties<Q: Into<Query>>(
&self,
q: Q,
name: Identifier,
value: &Json,
) -> Result<()>
pub fn set_properties<Q: Into<Query>>( &self, q: Q, name: Identifier, value: &Json, ) -> Result<()>
Sets properties.
§Arguments
q
: The query to run.name
: The property name.value
: The property value.
Sourcepub fn bulk_insert(&self, items: Vec<BulkInsertItem>) -> Result<()>
pub fn bulk_insert(&self, items: Vec<BulkInsertItem>) -> Result<()>
Sourcepub fn index_property(&self, name: Identifier) -> Result<()>
pub fn index_property(&self, name: Identifier) -> Result<()>
Enables indexing on a specified property. When indexing is enabled on a property, it’s possible to query on its presence and values.
§Arguments
name
: The name of the property to index.