Function insert

Source
pub async fn insert<T>(client: &Client, entity: T) -> Result<u64, Error>
where T: SqlQuery + SqlParams + Send + Sync + 'static,
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