pub struct Memgraph { /* private fields */ }Expand description
Main object to interact with Memgraph instance.
Implementations§
Source§impl Memgraph
impl Memgraph
Sourcepub fn new(
args: *const mgp_list,
graph: *const mgp_graph,
result: *mut mgp_result,
memory: *mut mgp_memory,
module: *mut mgp_module,
) -> Memgraph
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.
Sourcepub fn module_ptr(&self) -> *mut mgp_module
pub fn module_ptr(&self) -> *mut mgp_module
Returns pointer to the module object.
pub fn vertices_iter(&self) -> MgpResult<VerticesIterator>
pub fn vertex_by_id(&self, id: i64) -> MgpResult<Vertex>
Sourcepub fn result_record(&self) -> MgpResult<ResultRecord>
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.
Sourcepub 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<()>
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.
Sourcepub fn must_abort(&self) -> bool
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.