Memgraph

Struct Memgraph 

Source
pub struct Memgraph { /* private fields */ }
Expand description

Main object to interact with Memgraph instance.

Implementations§

Source§

impl Memgraph

Source

pub fn new( args: *const mgp_list, graph: *const mgp_graph, result: *mut mgp_result, memory: *mut mgp_memory, module: *mut mgp_module, ) -> Memgraph

Create a new Memgraph object.

Required to be public because the required pointers have to passed during module initialization and procedure call phase.

Source

pub fn args(&self) -> MgpResult<List>

Arguments passed to the procedure call.

Source

pub fn module_ptr(&self) -> *mut mgp_module

Returns pointer to the module object.

Source

pub fn vertices_iter(&self) -> MgpResult<VerticesIterator>

Source

pub fn vertex_by_id(&self, id: i64) -> MgpResult<Vertex>

Source

pub fn result_record(&self) -> MgpResult<ResultRecord>

Creates a new result record.

Keep this object on the stack and add data that will be returned to Memgraph / client during/after the procedure call.

Source

pub fn add_read_procedure( &self, proc_ptr: extern "C" fn(*const mgp_list, *const mgp_graph, *mut mgp_result, *mut mgp_memory), name: &CStr, required_arg_types: &[NamedType<'_>], optional_arg_types: &[OptionalNamedType<'_>], result_field_types: &[NamedType<'_>], ) -> MgpResult<()>

Registers a new read procedure.

  • proc_ptr - Identifier of the top level C function that represents the procedure.
  • name - A string that will be registered as a procedure name inside Memgraph instance.
  • required_arg_types - An array of all NamedTypes, each one define by name and an array of Types.
  • optional_arg_types - An array of all OptionalNamedTypes, each one defined by name, an array of Types, and default value.
  • result_field_types - An array of all NamedTypes, each one defined by name and an array of Types.
Source

pub fn must_abort(&self) -> bool

Return true if the currently executing procedure should abort as soon as possible.

Procedures which perform heavyweight processing run the risk of running too long and going over the query execution time limit. To prevent this, such procedures should periodically call this function at critical points in their code in order to determine whether they should abort or not. Note that this mechanism is purely cooperative and depends on the procedure doing the checking and aborting on its own.

Trait Implementations§

Source§

impl Clone for Memgraph

Source§

fn clone(&self) -> Memgraph

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.