Arguments
| Argument | Description |
|---|---|
resource
| The table name or the specific record ID to create. |
data
| The document / record data to insert. |
data
| The relation table data to insert. |
Example usage
Inserting a record with a specific ID:
Inserting multiple records into a table:
An example of two person records and one company record, followed by .insert().relation() to create a relation between them. Note the usage of the #[surreal(rename)] attribute to interface between the Rust struct Founded and the original relation table, which must have an in and an out field.
The equivalent SurrealQL statements to create and query the relations are: