// Create a record with a random ID letperson: Option<Person> =db.create("person").await?; dbg!(person); // Create a record with a specific ID letrecord: Option<Record> =db .create(("person","tobie")) .content(Person{ name: Some("Tobie".into()), marketing: Some(true), }) .await?; dbg!(record); Ok(()) }
Creates one or more records in the database.
Method Syntax
db.create(resource).content(data)
Arguments
Argument
Type
Description
resource
The table name or the specific record ID to create.
// Create a record with a random ID letperson: Option<Person> =db.create("person").await?; dbg!(person); // Create a record with a specific ID letrecord: Option<Record> =db .create(("person","tobie")) .content(Person{ name: Some("Tobie".into()), marketing: Some(true), }) .await?; dbg!(record); Ok(()) }
Translated query
This function will run the following query in the database: