Module attrs

Module attrs 

Source
Expand description

Attribute markers for PostgresTable derive macro.

These const markers are used within #[column(...)] and #[PostgresTable(...)] attributes. Import them from the prelude to get IDE hover documentation.

§Example


#[PostgresTable(NAME = "users")]
struct User {
    #[column(PRIMARY, SERIAL)]
    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§

BIGINT
Specifies a BIGINT column type (64-bit).
BIGSERIAL
Creates a BIGSERIAL column (auto-incrementing 64-bit integer).
BIT
Specifies a BIT column type.
BIT_VARYING
Alias for VARBIT.
BOOL
Alias for BOOLEAN.
BOOLEAN
Specifies a BOOLEAN column type.
BOX
Specifies a BOX column type.
BYTEA
Specifies a BYTEA column type (binary data).
CASCADE
CASCADE action: Propagate the delete/update to referencing rows.
CHAR
Specifies a CHAR column type.
CHARACTER
Alias for CHAR.
CHARACTER_VARYING
Alias for VARCHAR.
CHECK
Adds a CHECK constraint to this column.
CIDR
Specifies a CIDR column type.
CIRCLE
Specifies a CIRCLE column type.
DATE
Specifies a DATE column type.
DECIMAL
Alias for NUMERIC.
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.
DOUBLE
Alias for DOUBLE PRECISION.
DOUBLE_PRECISION
Specifies a DOUBLE PRECISION column type (64-bit float).
ENUM
Marks this column as storing an enum type.
EXISTING
Marks the view as existing (skip creation).
FLOAT4
Alias for REAL.
FLOAT8
Alias for DOUBLE PRECISION.
GENERATED
Marks a column as a GENERATED AS (expression) column.
IDENTITY
Creates a GENERATED IDENTITY column with configurable mode.
INET
Specifies an INET column type.
INHERITS
Specifies inheritance from a parent table.
INT
Alias for INTEGER.
INT2
Alias for SMALLINT.
INT4
Alias for INTEGER.
INT8
Alias for BIGINT.
INTEGER
Specifies an INTEGER column type (32-bit).
INTERVAL
Specifies an INTERVAL column type.
JSON
Enables JSON serialization with JSON type storage.
JSONB
Enables JSON serialization with JSONB storage.
LINE
Specifies a LINE column type.
LSEG
Specifies a LSEG column type.
MACADDR
Specifies a MACADDR column type.
MACADDR8
Specifies a MACADDR8 column type.
MATERIALIZED
Marks the view as materialized.
NAME
Specifies a custom name in the database.
NO_ACTION
NO ACTION action: Similar to RESTRICT (default behavior).
NUMERIC
Specifies a NUMERIC column type (arbitrary precision).
ON_DELETE
Specifies the ON DELETE action for foreign key references.
ON_UPDATE
Specifies the ON UPDATE action for foreign key references.
PATH
Specifies a PATH column type.
POINT
Specifies a POINT column type.
POLYGON
Specifies a POLYGON column type.
PRIMARY
Marks this column as the PRIMARY KEY.
PRIMARY_KEY
Alias for PRIMARY.
REAL
Specifies a REAL column type (32-bit float).
REFERENCES
Establishes a foreign key reference to another table’s column.
RESTRICT
RESTRICT action: Prevent delete/update if referenced.
SCHEMA
Specifies a view schema name.
SERIAL
Creates a SERIAL column (auto-incrementing 32-bit integer).
SET_DEFAULT
SET DEFAULT action: Set referencing columns to their default values.
SET_NULL
SET NULL action: Set referencing columns to NULL.
SMALLINT
Specifies a SMALLINT column type (16-bit).
SMALLSERIAL
Creates a SMALLSERIAL column (auto-incrementing 16-bit integer).
TABLESPACE
Specifies a tablespace for the table.
TEMPORARY
Creates a TEMPORARY table.
TEXT
Specifies a TEXT column type.
TIME
Specifies a TIME column type (without timezone).
TIMESTAMP
Specifies a TIMESTAMP column type (without timezone).
TIMESTAMPTZ
Specifies a TIMESTAMPTZ column type (with timezone).
TIMESTAMP_WITHOUT_TIME_ZONE
Alias for TIMESTAMP.
TIMESTAMP_WITH_TIME_ZONE
Alias for TIMESTAMPTZ.
TIMETZ
Specifies a TIMETZ column type (with timezone).
TIME_WITHOUT_TIME_ZONE
Alias for TIME.
TIME_WITH_TIME_ZONE
Alias for TIMETZ.
UNIQUE
Adds a UNIQUE constraint to this column.
UNLOGGED
Creates an UNLOGGED table.
USING
Specifies a USING clause for materialized views.
UUID
Specifies a UUID column type.
VARBIT
Specifies a VARBIT column type.
VARCHAR
Specifies a VARCHAR column type.
WITH
Sets WITH options for a view definition.
WITH_NO_DATA
Create a materialized view WITH NO DATA.
WITH_OPTIONS
Alias for WITH.

Type Aliases§

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