Struct Database

Source
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>

Source

pub fn new(datastore: D) -> Database<D>

Creates a new database.

§Arguments
  • datastore: The underlying datastore to use.
Source

pub fn sync(&self) -> Result<()>

Syncs persisted content. Depending on the datastore implementation, this has different meanings - including potentially being a no-op.

Source

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.
Source

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.
Source

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.
Source

pub fn get<Q: Into<Query>>(&self, q: Q) -> Result<Vec<QueryOutputValue>>

Gets values specified by a query.

§Arguments
  • q: The query to run.
Source

pub fn delete<Q: Into<Query>>(&self, q: Q) -> Result<()>

Deletes values specified by a query.

§Arguments
  • q: The query to run.
Source

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.
Source

pub fn bulk_insert(&self, items: Vec<BulkInsertItem>) -> Result<()>

Bulk inserts many vertices, edges, and/or properties.

§Arguments
  • items: The items to insert.
Source

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.

Auto Trait Implementations§

§

impl<D> Freeze for Database<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for Database<D>
where D: RefUnwindSafe,

§

impl<D> Send for Database<D>
where D: Send,

§

impl<D> Sync for Database<D>
where D: Sync,

§

impl<D> Unpin for Database<D>
where D: Unpin,

§

impl<D> UnwindSafe for Database<D>
where D: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.