Function insert
Source pub async fn insert<T, P: for<'a> FromSql<'a> + Send + Sync>(
client: &Client,
entity: T,
) -> Result<P, Error>
Expand description
§insert
Inserts a new record into the database.
§Parameters
client
: Database connection object
entity
: Data object to be inserted (must implement SqlQuery and SqlParams traits)
§Return Value
Result<u64, Error>
: On success, returns the number of inserted records; on failure, returns Error