Function rorm::rorm_db_insert_returning
source · #[no_mangle]
pub extern "C" fn rorm_db_insert_returning(
db: &'static Database,
transaction: Option<&'static mut Transaction>,
model: FFIString<'static>,
columns: FFISlice<'static, FFIString<'static>>,
row: FFISlice<'static, FFIValue<'static>>,
returning: FFISlice<'static, FFIString<'static>>,
callback: Option<unsafe extern "C" fn(_: usize, _: Option<Box<Row>>, _: Error<'_>)>,
context: usize
)Expand description
This functions inserts a row into the database while returning the requested columns.
Parameter:
db: Reference tot he Database, provided by rorm_db_connecttransaction: Mutable pointer to a Transaction. Can be a null pointer to ignore this parameter.model: Name of the table to query.columns: Array of columns to insert to the table.row: List of values to insert. Must be of the same length ascolumns.returning: Array of column to return after for the insert operation.callback: callback function. Takes thecontexta pointer to a row and an Error.context: Pass through void pointer.
Important:
- Make sure that
db,model,columns,rowandreturningare allocated until the callback is executed. - The Row that is returned in the callback is freed after the callback has ended.
This function is called from an asynchronous context.