Module attrs

Module attrs 

Source
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)]
struct User {
    #[column(primary, autoincrement)]
    id: i32,
    #[column(unique)]
    email: String,
    metadata: String,
}

Structs§

ColumnMarker
Marker struct for column constraint attributes.
NameMarker
Marker struct for the NAME attribute.
TableMarker
Marker struct for table-level attributes.
TypeMarker
Marker struct for column type attributes.
ViewMarker
Marker struct for view attributes.

Constants§

ANY
Specifies an ANY column type (STRICT tables only).
AUTOINCREMENT
Enables AUTOINCREMENT for INTEGER PRIMARY KEY columns.
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.
DEFAULT
Specifies a fixed default value for new rows.
DEFAULT_FN
Specifies a function to generate default values at runtime.
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).
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.
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.
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 this column.
WITHOUT_ROWID
Enables WITHOUT ROWID optimization for the table.

Type Aliases§

ReferentialAction
Type alias for referential action markers (uses ColumnMarker for macro compatibility).