Models describe the shape of your records and give the SDK the type information it needs for type-safe CRUD operations and predicates.
The @SurrealModel macro
The @SurrealModel macro is the recommended way to declare a model. It takes the table name and generates everything the SDK needs:
The macro generates:
static let surrealTable, the table name passed to the macro.A
Fieldsnamespace for building type-safe predicates such asPerson.Fields.age >= 18.
Manual conformance
If you prefer not to use the macro, you can conform to SurrealModel manually by declaring the surrealTable property:
Manual conformance does not generate a Fields namespace, so you will need to write raw predicates for queries that filter on fields.