Expand description
Attribute markers for SQLiteTable derive macro.
These const markers are used within #[column(...)] and #[SQLiteTable(...)]
attributes. Import them from the prelude to get IDE hover documentation.
§Example
#[SQLiteTable(
name = "users",
strict,
unique(columns(email, tenant_id)),
check(name = "users_score_check", expr = "score >= 0")
)]
struct User {
#[column(primary, autoincrement)]
id: i32,
#[column(unique)]
email: String,
tenant_id: i32,
score: i32,
metadata: String,
}Structs§
- Column
Marker - Marker struct for column constraint attributes.
- Name
Marker - Marker struct for the NAME attribute.
- Table
Marker - Marker struct for table-level attributes.
- Type
Marker - Marker struct for column type attributes.
- View
Marker - Marker struct for view attributes.
Constants§
- ANY
- Specifies an ANY column type (STRICT tables only).
- AUTOINCREMENT
- Enables AUTOINCREMENT for INTEGER PRIMARY KEY columns.
- BINARY
- BINARY collation: bytewise comparison of operands. The default for
BLOBcolumns and any column without an explicit collation. - BLOB
- Specifies a BLOB column type.
- BOOLEAN
- Specifies a BOOLEAN column (stored as INTEGER 0/1).
- CASCADE
- CASCADE action: Propagate the delete/update to referencing rows.
- CHECK
- Adds a CHECK constraint for a column or table.
- COLLATE
- Specifies a collation sequence for a text column.
- DEFAULT
- Specifies a fixed default value for new rows.
- DEFAULT_
FN - Specifies a function to generate default values at runtime.
- DEFAULT_
SQL - Specifies a raw SQL default expression for new rows.
- DEFINITION
- Specifies a view definition SQL string or expression.
- ENUM
- Marks this column as storing an enum type.
- EXISTING
- Marks the view as existing (skip creation).
- FOREIGN_
KEY - Adds a table-level composite foreign key constraint.
- GENERATED
- Marks this column as a generated column.
- INTEGER
- Specifies an INTEGER column type.
- JSON
- Enables JSON serialization with TEXT storage.
- JSONB
- Enables JSON serialization with BLOB storage.
- NAME
- Specifies a custom name in the database.
- NOCASE
- NOCASE collation: ASCII case-insensitive comparison. Useful for text columns that need case-insensitive equality / sorting.
- NO_
ACTION - NO ACTION action: Similar to RESTRICT (default behavior).
- NUMERIC
- Specifies a NUMERIC column type.
- ON_
DELETE - Specifies the ON DELETE action for foreign key references.
- ON_
UPDATE - Specifies the ON UPDATE action for foreign key references.
- PRIMARY
- Marks this column as the PRIMARY KEY.
- PRIMARY_
KEY - Alias for
PRIMARY. - REAL
- Specifies a REAL column type.
- REFERENCES
- Establishes a foreign key reference to another table’s column.
- RESTRICT
- RESTRICT action: Prevent delete/update if referenced.
- RTRIM
- RTRIM collation: like
BINARYbut trailing spaces are ignored when comparing. - SET_
DEFAULT - SET DEFAULT action: Set referencing columns to their default values.
- SET_
NULL - SET NULL action: Set referencing columns to NULL.
- STRICT
- Enables STRICT mode for the table.
- TEXT
- Specifies a TEXT column type.
- UNIQUE
- Adds a UNIQUE constraint to a column, table, or index.
- WITHOUT_
ROWID - Enables WITHOUT ROWID optimization for the table.
Type Aliases§
- Referential
Action - Type alias for referential action markers (uses
ColumnMarkerfor macro compatibility).