pub async fn insert<T, P: for<'a> FromSql<'a> + Send + Sync>(
transaction: &Transaction<'_>,
entity: T,
) -> Result<P, Error>Expand description
§insert
Inserts a new record into the database within a transaction.
§Parameters
transaction: Transaction objectentity: Data object to be inserted (must implement SqlCommand and SqlParams traits)
§Return Value
Result<P, Error>: On success, returns the generated primary key; on failure, returns Error