mage
mage copied to clipboard
[BUG] Rust QM API reverts the boolean value from false to true and vice-versa
Here is the simple query that is used to replicate the scenario:
use c_str_macro::c_str;
use rsmgp_sys::memgraph::*;
use rsmgp_sys::mgp::*;
use rsmgp_sys::result::*;
use rsmgp_sys::rsmgp::*;
use rsmgp_sys::value::*;
use rsmgp_sys::{close_module, define_procedure, define_type, init_module};
use std::ffi::CString;
use std::os::raw::c_int;
use std::panic;
init_module!(|memgraph: &Memgraph| -> Result<()> {
memgraph.add_read_procedure(
test,
c_str!("test"),
&[define_type!("passed", Type::Bool)],
&[],
&[define_type!("returned", Type::Bool)],
)?;
Ok(())
});
define_procedure!(test, |memgraph: &Memgraph| -> Result<()> {
let args = memgraph.args()?;
let Value::Bool(weighted) = args.value_at(0)? else {
panic!("Failed to read weighted")
};
let result = memgraph.result_record()?;
let _ = result.insert_bool(c_str!("returned"), weighted);
Ok(())
});
close_module!(|| -> Result<()> { Ok(()) });
Run this in Memgraph:
CALL libhello_world.test(false) YIELD * RETURN *;
thanks for looking into this @antejavor
Please disregard that