Skip to main content

drizzle_postgres/
attrs.rs

1//! Names accepted inside `#[PostgresTable(...)]`, `#[column(...)]`,
2//! `#[PostgresView(...)]`, `#[PostgresIndex(...)]` and `#[PostgresPolicy(...)]`.
3//!
4//! The macros read these attributes by name, in any letter case; the
5//! constants here exist so your editor can show their documentation on
6//! hover. Import them through the prelude.
7//!
8//! # Examples
9//! ```rust
10//! # extern crate self as drizzle;
11//! # mod _drizzle {
12//! #     pub mod core { pub use drizzle_core::*; }
13//! #     pub mod error { pub use drizzle_core::error::*; }
14//! #     pub mod types { pub use drizzle_types::*; }
15//! #     pub mod migrations { pub use drizzle_migrations::*; }
16//! #     pub use drizzle_types::Dialect;
17//! #     pub use drizzle_types as ddl;
18//! #     pub mod postgres {
19//! #         pub mod values { pub use drizzle_postgres::values::*; }
20//! #         pub mod traits { pub use drizzle_postgres::traits::*; }
21//! #         pub mod common { pub use drizzle_postgres::common::*; }
22//! #         pub mod attrs { pub use drizzle_postgres::attrs::*; }
23//! #         pub mod builder { pub use drizzle_postgres::builder::*; }
24//! #         pub mod helpers { pub use drizzle_postgres::helpers::*; }
25//! #         pub mod expr { pub use drizzle_postgres::expr::*; }
26//! #         pub mod types { pub use drizzle_postgres::types::*; }
27//! #         #[cfg(feature = "aws-data-api")]
28//! #         pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
29//! #         pub struct Row;
30//! #         impl Row {
31//! #             pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
32//! #             pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
33//! #             pub fn len(&self) -> usize { unimplemented!() }
34//! #         }
35//! #         pub mod prelude {
36//! #             pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
37//! #             pub use drizzle_postgres::attrs::*;
38//! #             pub use drizzle_postgres::common::PostgresSchemaType;
39//! #             pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
40//! #             pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
41//! #             pub use drizzle_core::*;
42//! #         }
43//! #     }
44//! # }
45//! # pub use _drizzle::*;
46//! # pub use const_format;
47//! fn main() {
48//! use drizzle::postgres::prelude::*;
49//!
50//! #[PostgresTable(
51//!     NAME = "users",
52//!     UNLOGGED,
53//!     RLS,
54//!     UNIQUE(columns(email, tenant_id)),
55//!     CHECK(name = "users_score_check", expr = "score >= 0")
56//! )]
57//! struct User {
58//!     #[column(PRIMARY, SERIAL)]
59//!     id: i32,
60//!     #[column(UNIQUE)]
61//!     email: String,
62//!     tenant_id: i32,
63//!     score: i32,
64//!     metadata: String,
65//! }
66//! }
67//! ```
68
69/// Marker struct for column constraint attributes.
70#[derive(Debug, Clone, Copy)]
71pub struct ColumnMarker;
72
73//------------------------------------------------------------------------------
74// Primary Key Constraints
75//------------------------------------------------------------------------------
76
77/// Marks this column as the PRIMARY KEY.
78///
79/// # Examples
80/// ```rust
81/// # let _ = r####"
82/// #[column(PRIMARY)]
83/// id: i32,
84/// # "####;
85/// ```
86///
87/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-PRIMARY-KEYS>
88pub const PRIMARY: ColumnMarker = ColumnMarker;
89
90/// Alias for [`PRIMARY`].
91pub const PRIMARY_KEY: ColumnMarker = ColumnMarker;
92
93//------------------------------------------------------------------------------
94// Auto-increment Types
95//------------------------------------------------------------------------------
96
97/// Creates a SERIAL column (auto-incrementing 32-bit integer).
98///
99/// # Examples
100/// ```rust
101/// # let _ = r####"
102/// #[column(PRIMARY, SERIAL)]
103/// id: i32,
104/// # "####;
105/// ```
106///
107/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL>
108pub const SERIAL: ColumnMarker = ColumnMarker;
109
110/// Creates a BIGSERIAL column (auto-incrementing 64-bit integer).
111///
112/// # Examples
113/// ```rust
114/// # let _ = r####"
115/// #[column(PRIMARY, BIGSERIAL)]
116/// id: i64,
117/// # "####;
118/// ```
119///
120/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL>
121pub const BIGSERIAL: ColumnMarker = ColumnMarker;
122
123/// Creates a SMALLSERIAL column (auto-incrementing 16-bit integer).
124///
125/// # Examples
126/// ```rust
127/// # let _ = r####"
128/// #[column(PRIMARY, SMALLSERIAL)]
129/// id: i16,
130/// # "####;
131/// ```
132///
133/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-SERIAL>
134pub const SMALLSERIAL: ColumnMarker = ColumnMarker;
135
136//------------------------------------------------------------------------------
137// Uniqueness Constraints
138//------------------------------------------------------------------------------
139
140/// Adds a UNIQUE constraint to a column, table, or index.
141///
142/// # Examples
143/// ```rust
144/// # let _ = r####"
145/// #[column(UNIQUE)]
146/// email: String,
147///
148/// #[PostgresTable(UNIQUE(columns(email, tenant_id), deferrable))]
149/// struct Users {
150///     email: String,
151///     tenant_id: i32,
152/// }
153///
154/// #[PostgresIndex(unique)]
155/// struct UsersEmailIdx(Users::email);
156/// # "####;
157/// ```
158///
159/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-UNIQUE-CONSTRAINTS>
160pub const UNIQUE: ColumnMarker = ColumnMarker;
161
162//------------------------------------------------------------------------------
163// Identity Columns
164//------------------------------------------------------------------------------
165
166/// Creates a `GENERATED ... AS IDENTITY` column.
167///
168/// # Syntax
169/// - `identity` or `identity(always)`: `GENERATED ALWAYS`. The database
170///   rejects explicit values unless the insert says `OVERRIDING SYSTEM VALUE`,
171///   so the insert model has no setter for the column.
172/// - `identity(by_default)`: `GENERATED BY DEFAULT`. An explicit value wins.
173/// - Sequence options may follow the mode: `start`, `increment`,
174///   `min_value`, `max_value`, `cache`, `cycle`, as in
175///   `identity(always, start = 100, cycle)`.
176///
177/// # Examples
178/// ```rust
179/// # let _ = r####"
180/// // GENERATED ALWAYS AS IDENTITY - strictest mode
181/// #[column(identity(always), primary)]
182/// id: i64,
183///
184/// // GENERATED BY DEFAULT AS IDENTITY - allows override
185/// #[column(identity(by_default), primary)]
186/// id: i64,
187/// # "####;
188/// ```
189///
190/// # Technical Details
191/// `PostgreSQL`'s identity columns are SQL-standard compliant, unlike SERIAL.
192/// Use ALWAYS for auto-generated IDs, BY DEFAULT when you need to occasionally set values.
193///
194/// See: <https://www.postgresql.org/docs/current/ddl-identity-columns.html>
195pub const IDENTITY: ColumnMarker = ColumnMarker;
196
197/// Marks a column as a GENERATED AS (expression) column.
198///
199/// # Syntax
200/// - `generated(stored, "expression")` - Computed on write, stored on disk
201/// - `generated(virtual, "expression")` - Computed on read, not stored (`PostgreSQL` 18+)
202///
203/// # Examples
204/// ```rust
205/// # let _ = r####"
206/// #[column(generated(stored, "price * quantity"))]
207/// total: i32,
208///
209/// #[column(generated(virtual, "first_name || ' ' || last_name"))]
210/// full_name: String,
211/// # "####;
212/// ```
213///
214/// # Technical Details
215/// Generated columns cannot be written to directly.
216/// STORED columns are computed and stored on write.
217/// VIRTUAL columns are computed on read (`PostgreSQL` 18+).
218///
219/// See: <https://www.postgresql.org/docs/current/ddl-generated-columns.html>
220pub const GENERATED: ColumnMarker = ColumnMarker;
221
222//------------------------------------------------------------------------------
223// Serialization Modes
224//------------------------------------------------------------------------------
225
226/// Enables JSON serialization with JSON type storage.
227///
228/// # Examples
229/// ```rust
230/// # let _ = r####"
231/// #[column(JSON)]
232/// metadata: UserMetadata,
233/// # "####;
234/// ```
235///
236/// Requires the `serde` feature. The field type must implement `Serialize` and `Deserialize`.
237///
238/// See: <https://www.postgresql.org/docs/current/datatype-json.html>
239pub const JSON: ColumnMarker = ColumnMarker;
240
241/// Enables JSON serialization with JSONB storage.
242///
243/// # Examples
244/// ```rust
245/// # let _ = r####"
246/// #[column(JSONB)]
247/// config: AppConfig,
248/// # "####;
249/// ```
250///
251/// JSONB is the recommended JSON storage format for most use cases.
252/// It supports indexing and efficient querying.
253///
254/// Requires the `serde` feature. The field type must implement `Serialize` and `Deserialize`.
255///
256/// See: <https://www.postgresql.org/docs/current/datatype-json.html>
257pub const JSONB: ColumnMarker = ColumnMarker;
258
259/// Marks this column as storing an enum type.
260///
261/// # Examples
262/// ```rust
263/// # let _ = r####"
264/// #[column(ENUM)]
265/// role: Role,
266/// # "####;
267/// ```
268///
269/// The field's type must derive `PostgresEnum`, which decides the storage: an
270/// integer column sized by the `#[repr]` for an enum with explicit
271/// discriminants or an integer `#[repr]`, `text` under
272/// `#[postgres_enum(text)]`, and a native enum type otherwise. The table
273/// macro also detects such fields without this attribute.
274///
275/// See: <https://www.postgresql.org/docs/current/datatype-enum.html>
276pub const ENUM: ColumnMarker = ColumnMarker;
277
278//------------------------------------------------------------------------------
279// Collation Markers
280//------------------------------------------------------------------------------
281
282/// Specifies a collation for a text column.
283///
284/// PostgreSQL collation identifiers are quoted names; the DDL emitter
285/// wraps whatever you supply here in double quotes, so write the bare
286/// name (`"en_US"`, `"C"`, `"POSIX"`, or any `CREATE COLLATION` value).
287///
288/// # Examples
289/// ```rust
290/// # let _ = r####"
291/// #[column(COLLATE = "en_US")]
292/// name: String,
293/// # "####;
294/// ```
295///
296/// See: <https://www.postgresql.org/docs/current/collation.html>
297pub const COLLATE: ColumnMarker = ColumnMarker;
298
299//------------------------------------------------------------------------------
300// Default Value Parameters
301//------------------------------------------------------------------------------
302
303/// Specifies a function to generate default values at runtime.
304///
305/// The function is called when an insert model is created, to fill the
306/// field; a value set on the model afterwards replaces it. Cannot be combined
307/// with [`DEFAULT`].
308///
309/// # Examples
310/// ```rust
311/// # let _ = r####"
312/// #[column(DEFAULT_FN = Uuid::new_v4)]
313/// id: Uuid,
314/// # "####;
315/// ```
316///
317/// # Difference from DEFAULT
318/// - `DEFAULT_FN`: the application computes the value (for example a UUID).
319/// - `DEFAULT`: the database fills the value through a `DEFAULT` clause.
320pub const DEFAULT_FN: ColumnMarker = ColumnMarker;
321
322/// Specifies a database `DEFAULT` clause for new rows.
323///
324/// # Examples
325/// ```rust
326/// # let _ = r####"
327/// #[column(DEFAULT = 0)]
328/// count: i32,
329///
330/// #[column(DEFAULT = "guest")]
331/// role: String,
332///
333/// #[column(DEFAULT = now())]
334/// created_at: chrono::NaiveDateTime,
335/// # "####;
336/// ```
337///
338/// String literals are quoted SQL values. SQL keywords and function calls are
339/// emitted as database expressions. For application-generated values, use
340/// [`DEFAULT_FN`] instead.
341///
342/// See: <https://www.postgresql.org/docs/current/ddl-default.html>
343pub const DEFAULT: ColumnMarker = ColumnMarker;
344
345/// Establishes a foreign key reference to another table's column.
346///
347/// # Examples
348/// ```rust
349/// # let _ = r####"
350/// #[column(REFERENCES = User::id)]
351/// user_id: i32,
352/// # "####;
353/// ```
354///
355/// With the `query` feature this also generates relation accessors: a
356/// forward one on this table, named after the column without its `_id` suffix
357/// (`user_id` gives `.user()`), and a reverse one on the referenced table
358/// (see [`RELATION`]).
359///
360/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
361pub const REFERENCES: ColumnMarker = ColumnMarker;
362
363/// Names the accessor that loads this table's rows from the referenced table
364/// (the reverse relation).
365///
366/// By default it is the plural of this struct's name (`posts` for a `Post`
367/// table), or the singular when this column alone is unique, which loads an
368/// `Option` (`profile` for a `Profile` table). A column named for a role
369/// rather than the table it references starts the name with the role:
370/// `author_id` gives `users.author_posts()`, while `user_id` gives
371/// `users.posts()`. The name depends on this column alone, so `RELATION` is needed
372/// only to choose another one.
373///
374/// The forward relation (on this table) is unchanged; only the reverse
375/// accessor on the referenced table is renamed.
376///
377/// # Examples
378/// ```rust
379/// # let _ = r####"
380/// // Users get `.authored()` instead of `.author_posts()`
381/// #[column(REFERENCES = User::id, RELATION = "authored")]
382/// author_id: i32,
383/// # "####;
384/// ```
385///
386/// Requires a `REFERENCES` attribute on the same column.
387pub const RELATION: ColumnMarker = ColumnMarker;
388
389/// Names the many-to-many accessor the referenced table gets through this
390/// link table.
391///
392/// A table is a link table when it has exactly two foreign keys and its rows
393/// are that pair: the pair is the primary key or a `UNIQUE` constraint, or
394/// the table has no other column besides a single-column primary key, and
395/// neither key is unique on its own. Each referenced table then gets an
396/// accessor to the other one, named after the other column: `post_id` and
397/// `tag_id` in `PostTags` give `posts.tags()` and `tags.posts()`. A link whose
398/// name adds to what it links appends it, so `PostLikes` gives
399/// `users.posts_via_likes()` and never clashes with another link.
400///
401/// `MANY_TO_MANY` chooses another name, and makes any table with two foreign keys a
402/// link table.
403///
404/// # Examples
405/// ```rust
406/// # let _ = r####"
407/// // users.liked_posts() instead of users.posts_via_likes()
408/// #[column(REFERENCES = User::id, MANY_TO_MANY = "liked_posts")]
409/// user_id: i32,
410/// # "####;
411/// ```
412///
413/// Requires a `REFERENCES` attribute on the same column.
414pub const MANY_TO_MANY: ColumnMarker = ColumnMarker;
415
416/// Specifies the ON DELETE action for foreign key references.
417///
418/// # Examples
419/// ```rust
420/// # let _ = r####"
421/// #[column(REFERENCES = User::id, ON_DELETE = CASCADE)]
422/// user_id: i32,
423/// # "####;
424/// ```
425///
426/// # Supported Actions
427/// - `CASCADE`: Delete rows that reference the deleted row
428/// - `SET_NULL`: Set the column to NULL when referenced row is deleted
429/// - `SET_DEFAULT`: Set the column to its default value
430/// - `RESTRICT`: Prevent deletion if referenced
431/// - `NO_ACTION`: Similar to RESTRICT (default)
432///
433/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
434pub const ON_DELETE: ColumnMarker = ColumnMarker;
435
436/// Specifies the ON UPDATE action for foreign key references.
437///
438/// # Examples
439/// ```rust
440/// # let _ = r####"
441/// #[column(REFERENCES = User::id, ON_UPDATE = CASCADE)]
442/// user_id: i32,
443/// # "####;
444/// ```
445///
446/// # Supported Actions
447/// - `CASCADE`: Update referencing rows when referenced row is updated
448/// - `SET_NULL`: Set the column to NULL when referenced row is updated
449/// - `SET_DEFAULT`: Set the column to its default value
450/// - `RESTRICT`: Prevent update if referenced
451/// - `NO_ACTION`: Similar to RESTRICT (default)
452///
453/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
454pub const ON_UPDATE: ColumnMarker = ColumnMarker;
455
456/// Marks a foreign key or table-level UNIQUE constraint as DEFERRABLE.
457///
458/// # Examples
459/// ```rust
460/// # let _ = r####"
461/// #[column(REFERENCES = Users::id, DEFERRABLE)]
462/// user_id: i32,
463///
464/// #[PostgresTable(UNIQUE(columns(email, tenant_id), deferrable))]
465/// struct Users {
466///     email: String,
467///     tenant_id: i32,
468/// }
469/// # "####;
470/// ```
471///
472/// See: <https://www.postgresql.org/docs/current/sql-createtable.html>
473pub const DEFERRABLE: ColumnMarker = ColumnMarker;
474
475/// Marks a foreign key or table-level UNIQUE constraint as DEFERRABLE INITIALLY DEFERRED.
476///
477/// # Examples
478/// ```rust
479/// # let _ = r####"
480/// #[column(REFERENCES = Users::id, INITIALLY_DEFERRED)]
481/// user_id: i32,
482///
483/// #[PostgresTable(UNIQUE(columns(email, tenant_id), initially_deferred))]
484/// struct Users {
485///     email: String,
486///     tenant_id: i32,
487/// }
488/// # "####;
489/// ```
490///
491/// See: <https://www.postgresql.org/docs/current/sql-createtable.html>
492pub const INITIALLY_DEFERRED: ColumnMarker = ColumnMarker;
493
494//------------------------------------------------------------------------------
495// Referential Action Values
496//------------------------------------------------------------------------------
497
498/// Type alias for referential action markers (uses `ColumnMarker` for macro compatibility).
499pub type ReferentialAction = ColumnMarker;
500
501/// CASCADE action: Propagate the delete/update to referencing rows.
502///
503/// # Examples
504/// ```rust
505/// # let _ = r####"
506/// #[column(REFERENCES = User::id, ON_DELETE = CASCADE)]
507/// user_id: i32,
508/// # "####;
509/// ```
510///
511/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
512pub const CASCADE: ColumnMarker = ColumnMarker;
513
514/// SET NULL action: Set referencing columns to NULL.
515///
516/// # Examples
517/// ```rust
518/// # let _ = r####"
519/// #[column(REFERENCES = User::id, ON_DELETE = SET_NULL)]
520/// user_id: Option<i32>,
521/// # "####;
522/// ```
523///
524/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
525pub const SET_NULL: ColumnMarker = ColumnMarker;
526
527/// SET DEFAULT action: Set referencing columns to their default values.
528///
529/// # Examples
530/// ```rust
531/// # let _ = r####"
532/// #[column(REFERENCES = User::id, ON_DELETE = SET_DEFAULT, DEFAULT = 0)]
533/// user_id: i32,
534/// # "####;
535/// ```
536///
537/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
538pub const SET_DEFAULT: ColumnMarker = ColumnMarker;
539
540/// RESTRICT action: Prevent delete/update if referenced.
541///
542/// # Examples
543/// ```rust
544/// # let _ = r####"
545/// #[column(REFERENCES = User::id, ON_DELETE = RESTRICT)]
546/// user_id: i32,
547/// # "####;
548/// ```
549///
550/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
551pub const RESTRICT: ColumnMarker = ColumnMarker;
552
553/// NO ACTION action: Similar to RESTRICT (default behavior).
554///
555/// # Examples
556/// ```rust
557/// # let _ = r####"
558/// #[column(REFERENCES = User::id, ON_DELETE = NO_ACTION)]
559/// user_id: i32,
560/// # "####;
561/// ```
562///
563/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
564pub const NO_ACTION: ColumnMarker = ColumnMarker;
565
566/// Adds a CHECK constraint to a column or table.
567///
568/// # Examples
569/// ```rust
570/// # let _ = r####"
571/// #[column(CHECK = "age >= 0")]
572/// age: i32,
573///
574/// #[PostgresTable(CHECK(name = "valid_score", expr = "score >= 0 AND score <= 100"))]
575/// struct Scores {
576///     score: i32,
577/// }
578/// # "####;
579/// ```
580///
581/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS>
582pub const CHECK: ColumnMarker = ColumnMarker;
583
584//------------------------------------------------------------------------------
585// Name Marker (shared by column and table attributes)
586//------------------------------------------------------------------------------
587
588/// Marker struct for the NAME attribute.
589#[derive(Debug, Clone, Copy)]
590pub struct NameMarker;
591
592/// Specifies a custom name in the database.
593///
594/// By default a table or view is named after its struct in `snake_case`, and
595/// a column after its field. Use `NAME` to choose another name.
596///
597/// # Examples
598/// ```rust
599/// # let _ = r####"
600/// // Column `creation_timestamp` instead of `created_at`:
601/// #[column(NAME = "creation_timestamp")]
602/// created_at: DateTime<Utc>,
603///
604/// // Table `user_accounts` instead of `user_account`:
605/// #[PostgresTable(NAME = "user_accounts")]
606/// struct UserAccount { ... }
607///
608/// #[PostgresView(NAME = "active_users")]
609/// struct ActiveUsers { ... }
610/// # "####;
611/// ```
612pub const NAME: NameMarker = NameMarker;
613
614//------------------------------------------------------------------------------
615// View Attribute Markers
616//------------------------------------------------------------------------------
617
618/// Marker struct for view attributes.
619#[derive(Debug, Clone, Copy)]
620pub struct ViewMarker;
621
622/// Specifies a view definition SQL string or expression.
623///
624/// # Examples
625/// ```rust
626/// # let _ = r####"
627/// #[PostgresView(DEFINITION = "SELECT id, name FROM users")]
628/// struct UserNames { id: i32, name: String }
629/// # "####;
630/// ```
631///
632/// ```rust
633/// # let _ = r####"
634/// #[PostgresView(
635///     DEFINITION = {
636///         let builder = drizzle::postgres::builder::QueryBuilder::new::<Schema>();
637///         let Schema { user } = Schema::new();
638///         builder.select((user.id, user.name)).from(user)
639///     }
640/// )]
641/// struct UserNames { id: i32, name: String }
642/// # "####;
643/// ```
644pub const DEFINITION: ViewMarker = ViewMarker;
645
646/// Specifies a table or view schema name.
647///
648/// # Examples
649/// ```rust
650/// # let _ = r####"
651/// #[PostgresView(SCHEMA = "auth")]
652/// struct AuthUsers { ... }
653///
654/// #[PostgresTable(SCHEMA = "auth")]
655/// struct AuthUsersTable { id: i32 }
656/// # "####;
657/// ```
658pub const SCHEMA: ViewMarker = ViewMarker;
659
660/// Marks the view as materialized.
661///
662/// # Examples
663/// ```rust
664/// # let _ = r####"
665/// #[PostgresView(MATERIALIZED)]
666/// struct ActiveUsers { ... }
667/// # "####;
668/// ```
669pub const MATERIALIZED: ViewMarker = ViewMarker;
670
671/// Sets WITH options for a view definition.
672///
673/// # Examples
674/// ```rust
675/// # let _ = r####"
676/// #[PostgresView(WITH = ViewWithOptionDef::new().security_barrier())]
677/// struct ActiveUsers { ... }
678/// # "####;
679/// ```
680pub const WITH: ViewMarker = ViewMarker;
681
682/// Alias for [`WITH`].
683pub const WITH_OPTIONS: ViewMarker = ViewMarker;
684
685/// Create a materialized view WITH NO DATA.
686///
687/// # Examples
688/// ```rust
689/// # let _ = r####"
690/// #[PostgresView(MATERIALIZED, WITH_NO_DATA)]
691/// struct ActiveUsers { ... }
692/// # "####;
693/// ```
694pub const WITH_NO_DATA: ViewMarker = ViewMarker;
695
696/// Specifies a USING clause for materialized views or row-level security policies.
697///
698/// # Examples
699/// ```rust
700/// # let _ = r####"
701/// #[PostgresView(USING = "heap")]
702/// struct ActiveUsers { ... }
703///
704/// #[PostgresPolicy(USING = "tenant_id = current_setting('app.tenant_id')::int")]
705/// struct TenantPolicy(Users);
706/// # "####;
707/// ```
708pub const USING: ViewMarker = ViewMarker;
709
710/// Marks the view as existing (skip creation).
711///
712/// # Examples
713/// ```rust
714/// # let _ = r####"
715/// #[PostgresView(EXISTING)]
716/// struct ExistingView { ... }
717/// # "####;
718/// ```
719pub const EXISTING: ViewMarker = ViewMarker;
720
721//------------------------------------------------------------------------------
722// Table Attribute Markers
723//------------------------------------------------------------------------------
724
725/// Marker struct for table-level attributes.
726#[derive(Debug, Clone, Copy)]
727pub struct TableMarker;
728
729/// Adds a table-level composite foreign key constraint.
730///
731/// # Examples
732/// ```rust
733/// # let _ = r####"
734/// #[PostgresTable(FOREIGN_KEY(
735///     columns(tenant_id, user_id),
736///     references(Users, tenant_id, id),
737///     on_delete = "CASCADE",
738///     deferrable
739/// ))]
740/// struct Posts {
741///     tenant_id: i32,
742///     user_id: i32,
743/// }
744/// # "####;
745/// ```
746///
747/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
748pub const FOREIGN_KEY: TableMarker = TableMarker;
749
750/// Creates an UNLOGGED table.
751///
752/// # Examples
753/// ```rust
754/// # mod drizzle {
755/// #     pub mod core { pub use drizzle_core::*; }
756/// #     pub mod error { pub use drizzle_core::error::*; }
757/// #     pub mod types { pub use drizzle_types::*; }
758/// #     pub mod migrations { pub use drizzle_migrations::*; }
759/// #     pub use drizzle_types::Dialect;
760/// #     pub use drizzle_types as ddl;
761/// #     pub mod postgres {
762/// #         pub mod values { pub use drizzle_postgres::values::*; }
763/// #         pub mod traits { pub use drizzle_postgres::traits::*; }
764/// #         pub mod common { pub use drizzle_postgres::common::*; }
765/// #         pub mod attrs { pub use drizzle_postgres::attrs::*; }
766/// #         pub mod builder { pub use drizzle_postgres::builder::*; }
767/// #         pub mod helpers { pub use drizzle_postgres::helpers::*; }
768/// #         pub mod expr { pub use drizzle_postgres::expr::*; }
769/// #         pub mod types { pub use drizzle_postgres::types::*; }
770/// #         #[cfg(feature = "aws-data-api")]
771/// #         pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
772/// #         pub struct Row;
773/// #         impl Row {
774/// #             pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
775/// #             pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
776/// #             pub fn len(&self) -> usize { unimplemented!() }
777/// #         }
778/// #         pub mod prelude {
779/// #             pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
780/// #             pub use drizzle_postgres::attrs::*;
781/// #             pub use drizzle_postgres::common::PostgresSchemaType;
782/// #             pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
783/// #             pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
784/// #             pub use drizzle_core::*;
785/// #         }
786/// #     }
787/// # }
788/// use drizzle::postgres::prelude::*;
789///
790/// #[PostgresTable(UNLOGGED)]
791/// struct SessionCache {
792///     #[column(PRIMARY)]
793///     key: String,
794///     data: String,
795/// }
796/// ```
797///
798/// Unlogged tables are faster but data is not crash-safe.
799///
800/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED>
801pub const UNLOGGED: TableMarker = TableMarker;
802
803/// Creates a TEMPORARY table.
804///
805/// # Examples
806/// ```rust
807/// # mod drizzle {
808/// #     pub mod core { pub use drizzle_core::*; }
809/// #     pub mod error { pub use drizzle_core::error::*; }
810/// #     pub mod types { pub use drizzle_types::*; }
811/// #     pub mod migrations { pub use drizzle_migrations::*; }
812/// #     pub use drizzle_types::Dialect;
813/// #     pub use drizzle_types as ddl;
814/// #     pub mod postgres {
815/// #         pub mod values { pub use drizzle_postgres::values::*; }
816/// #         pub mod traits { pub use drizzle_postgres::traits::*; }
817/// #         pub mod common { pub use drizzle_postgres::common::*; }
818/// #         pub mod attrs { pub use drizzle_postgres::attrs::*; }
819/// #         pub mod builder { pub use drizzle_postgres::builder::*; }
820/// #         pub mod helpers { pub use drizzle_postgres::helpers::*; }
821/// #         pub mod expr { pub use drizzle_postgres::expr::*; }
822/// #         pub mod types { pub use drizzle_postgres::types::*; }
823/// #         #[cfg(feature = "aws-data-api")]
824/// #         pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
825/// #         pub struct Row;
826/// #         impl Row {
827/// #             pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
828/// #             pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
829/// #             pub fn len(&self) -> usize { unimplemented!() }
830/// #         }
831/// #         pub mod prelude {
832/// #             pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
833/// #             pub use drizzle_postgres::attrs::*;
834/// #             pub use drizzle_postgres::common::PostgresSchemaType;
835/// #             pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
836/// #             pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
837/// #             pub use drizzle_core::*;
838/// #         }
839/// #     }
840/// # }
841/// use drizzle::postgres::prelude::*;
842///
843/// #[PostgresTable(TEMPORARY)]
844/// struct TempData {
845///     id: i32,
846///     value: String,
847/// }
848/// ```
849///
850/// Temporary tables exist only for the current session.
851///
852/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-TEMPORARY>
853pub const TEMPORARY: TableMarker = TableMarker;
854
855/// Specifies inheritance from a parent table.
856///
857/// # Examples
858/// ```rust
859/// # mod drizzle {
860/// #     pub mod core { pub use drizzle_core::*; }
861/// #     pub mod error { pub use drizzle_core::error::*; }
862/// #     pub mod types { pub use drizzle_types::*; }
863/// #     pub mod migrations { pub use drizzle_migrations::*; }
864/// #     pub use drizzle_types::Dialect;
865/// #     pub use drizzle_types as ddl;
866/// #     pub mod postgres {
867/// #         pub mod values { pub use drizzle_postgres::values::*; }
868/// #         pub mod traits { pub use drizzle_postgres::traits::*; }
869/// #         pub mod common { pub use drizzle_postgres::common::*; }
870/// #         pub mod attrs { pub use drizzle_postgres::attrs::*; }
871/// #         pub mod builder { pub use drizzle_postgres::builder::*; }
872/// #         pub mod helpers { pub use drizzle_postgres::helpers::*; }
873/// #         pub mod expr { pub use drizzle_postgres::expr::*; }
874/// #         pub mod types { pub use drizzle_postgres::types::*; }
875/// #         #[cfg(feature = "aws-data-api")]
876/// #         pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
877/// #         pub struct Row;
878/// #         impl Row {
879/// #             pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
880/// #             pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
881/// #             pub fn len(&self) -> usize { unimplemented!() }
882/// #         }
883/// #         pub mod prelude {
884/// #             pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
885/// #             pub use drizzle_postgres::attrs::*;
886/// #             pub use drizzle_postgres::common::PostgresSchemaType;
887/// #             pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
888/// #             pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
889/// #             pub use drizzle_core::*;
890/// #         }
891/// #     }
892/// # }
893/// use drizzle::postgres::prelude::*;
894///
895/// #[PostgresTable(INHERITS = "base_table")]
896/// struct ChildTable {
897///     extra_field: String,
898/// }
899/// ```
900///
901/// See: <https://www.postgresql.org/docs/current/ddl-inherit.html>
902pub const INHERITS: TableMarker = TableMarker;
903
904/// Specifies a tablespace for the table.
905///
906/// # Examples
907/// ```rust
908/// # mod drizzle {
909/// #     pub mod core { pub use drizzle_core::*; }
910/// #     pub mod error { pub use drizzle_core::error::*; }
911/// #     pub mod types { pub use drizzle_types::*; }
912/// #     pub mod migrations { pub use drizzle_migrations::*; }
913/// #     pub use drizzle_types::Dialect;
914/// #     pub use drizzle_types as ddl;
915/// #     pub mod postgres {
916/// #         pub mod values { pub use drizzle_postgres::values::*; }
917/// #         pub mod traits { pub use drizzle_postgres::traits::*; }
918/// #         pub mod common { pub use drizzle_postgres::common::*; }
919/// #         pub mod attrs { pub use drizzle_postgres::attrs::*; }
920/// #         pub mod builder { pub use drizzle_postgres::builder::*; }
921/// #         pub mod helpers { pub use drizzle_postgres::helpers::*; }
922/// #         pub mod expr { pub use drizzle_postgres::expr::*; }
923/// #         pub mod types { pub use drizzle_postgres::types::*; }
924/// #         #[cfg(feature = "aws-data-api")]
925/// #         pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
926/// #         pub struct Row;
927/// #         impl Row {
928/// #             pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
929/// #             pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
930/// #             pub fn len(&self) -> usize { unimplemented!() }
931/// #         }
932/// #         pub mod prelude {
933/// #             pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
934/// #             pub use drizzle_postgres::attrs::*;
935/// #             pub use drizzle_postgres::common::PostgresSchemaType;
936/// #             pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
937/// #             pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
938/// #             pub use drizzle_core::*;
939/// #         }
940/// #     }
941/// # }
942/// use drizzle::postgres::prelude::*;
943///
944/// #[PostgresTable(TABLESPACE = "fast_storage")]
945/// struct HighPerfTable {
946///     #[column(PRIMARY)]
947///     id: i32,
948/// }
949///
950/// // Views also support TABLESPACE:
951/// // #[PostgresView(MATERIALIZED, TABLESPACE = "fast_storage")]
952/// // struct ActiveUsers { id: i32 }
953/// ```
954///
955/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-TABLESPACE>
956pub const TABLESPACE: TableMarker = TableMarker;
957
958/// Enables row-level security for the table.
959///
960/// # Examples
961/// ```rust
962/// # let _ = r####"
963/// #[PostgresTable(RLS)]
964/// struct Users {
965///     id: i32,
966/// }
967/// # "####;
968/// ```
969///
970/// See: <https://www.postgresql.org/docs/current/ddl-rowsecurity.html>
971pub const RLS: TableMarker = TableMarker;
972
973//------------------------------------------------------------------------------
974// Index Attribute Markers
975//------------------------------------------------------------------------------
976
977/// Marker struct for index attributes.
978#[derive(Debug, Clone, Copy)]
979pub struct IndexMarker;
980
981/// Creates or drops an index CONCURRENTLY.
982///
983/// # Examples
984/// ```rust
985/// # let _ = r####"
986/// #[PostgresIndex(concurrent)]
987/// struct UsersEmailIdx(Users::email);
988/// # "####;
989/// ```
990///
991/// See: <https://www.postgresql.org/docs/current/sql-createindex.html>
992pub const CONCURRENT: IndexMarker = IndexMarker;
993
994/// Specifies the index access method.
995///
996/// # Examples
997/// ```rust
998/// # let _ = r####"
999/// #[PostgresIndex(method = "gin")]
1000/// struct DocumentsSearchIdx(Documents::search_vector);
1001/// # "####;
1002/// ```
1003///
1004/// See: <https://www.postgresql.org/docs/current/indexes-types.html>
1005pub const METHOD: IndexMarker = IndexMarker;
1006
1007/// Specifies a partial-index predicate as raw PostgreSQL SQL.
1008///
1009/// Use database column names in the predicate. Rust field or column renames do
1010/// not rewrite this string.
1011///
1012/// # Examples
1013/// ```rust
1014/// # let _ = r####"
1015/// #[PostgresIndex(where = "deleted_at IS NULL")]
1016/// struct ActiveUsersEmailIdx(Users::email);
1017/// # "####;
1018/// ```
1019///
1020/// See: <https://www.postgresql.org/docs/current/indexes-partial.html>
1021pub const WHERE: IndexMarker = IndexMarker;
1022
1023//------------------------------------------------------------------------------
1024// Policy Attribute Markers
1025//------------------------------------------------------------------------------
1026
1027/// Marker struct for row-level security policy attributes.
1028#[derive(Debug, Clone, Copy)]
1029pub struct PolicyMarker;
1030
1031/// Specifies whether a policy is PERMISSIVE or RESTRICTIVE.
1032///
1033/// # Examples
1034/// ```rust
1035/// # let _ = r####"
1036/// #[PostgresPolicy(AS = "RESTRICTIVE")]
1037/// struct TenantPolicy(Users);
1038/// # "####;
1039/// ```
1040///
1041/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1042pub const AS: PolicyMarker = PolicyMarker;
1043
1044/// Alias for [`AS`].
1045pub const AS_CLAUSE: PolicyMarker = PolicyMarker;
1046
1047/// Specifies the command a policy applies to.
1048///
1049/// # Examples
1050/// ```rust
1051/// # let _ = r####"
1052/// #[PostgresPolicy(FOR = "SELECT")]
1053/// struct ReadPolicy(Users);
1054/// # "####;
1055/// ```
1056///
1057/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1058pub const FOR: PolicyMarker = PolicyMarker;
1059
1060/// Alias for [`FOR`].
1061pub const FOR_CLAUSE: PolicyMarker = PolicyMarker;
1062
1063/// Specifies roles the policy applies to.
1064///
1065/// # Examples
1066/// ```rust
1067/// # let _ = r####"
1068/// #[PostgresPolicy(TO("app_user", public))]
1069/// struct TenantPolicy(Users);
1070/// # "####;
1071/// ```
1072///
1073/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1074pub const TO: PolicyMarker = PolicyMarker;
1075
1076/// Specifies a WITH CHECK expression for INSERT/UPDATE policies.
1077///
1078/// # Examples
1079/// ```rust
1080/// # let _ = r####"
1081/// #[PostgresPolicy(WITH_CHECK = "tenant_id = current_setting('app.tenant_id')::int")]
1082/// struct TenantWritePolicy(Users);
1083/// # "####;
1084/// ```
1085///
1086/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1087pub const WITH_CHECK: PolicyMarker = PolicyMarker;
1088
1089//------------------------------------------------------------------------------
1090// Column Type Markers
1091//------------------------------------------------------------------------------
1092
1093/// Marker struct for `PostgreSQL` column type names.
1094///
1095/// `#[PostgresTable]` infers each column's SQL type from its Rust field type.
1096/// Of these names, only `VARCHAR(n)` and `CHAR(n)` can be written in
1097/// `#[column(...)]`; the rest document the types the macro can produce.
1098#[derive(Debug, Clone, Copy)]
1099pub struct TypeMarker;
1100
1101//--- Character Types ---
1102
1103/// The TEXT column type.
1104///
1105/// TEXT stores variable-length character strings with no length limit.
1106///
1107/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1108pub const TEXT: TypeMarker = TypeMarker;
1109
1110/// The VARCHAR column type.
1111///
1112/// VARCHAR stores variable-length character strings.
1113/// In `PostgreSQL`, VARCHAR without length limit is equivalent to TEXT.
1114/// Use `#[column(VARCHAR(255))]` to preserve a bounded physical column while
1115/// keeping the Rust field type as `String`; `Vec<String>` preserves the same
1116/// bound for each array element.
1117///
1118/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1119pub const VARCHAR: TypeMarker = TypeMarker;
1120
1121/// Another name for VARCHAR; write `VARCHAR(n)` in `#[column(...)]`.
1122pub const CHARACTER_VARYING: TypeMarker = TypeMarker;
1123
1124/// The CHAR column type.
1125///
1126/// CHAR stores fixed-length character strings.
1127/// Use `#[column(CHAR(8))]` to declare its required physical length. The same
1128/// marker on `Vec<String>` declares an array of bounded CHAR elements.
1129///
1130/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1131pub const CHAR: TypeMarker = TypeMarker;
1132
1133/// Another name for CHAR; write `CHAR(n)` in `#[column(...)]`.
1134pub const CHARACTER: TypeMarker = TypeMarker;
1135
1136//--- Integer Types ---
1137
1138/// The INTEGER column type (32-bit).
1139///
1140/// INTEGER (or INT4) stores 32-bit signed integers.
1141///
1142/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1143pub const INTEGER: TypeMarker = TypeMarker;
1144
1145/// Alias for INTEGER.
1146pub const INT: TypeMarker = TypeMarker;
1147
1148/// Alias for INTEGER.
1149pub const INT4: TypeMarker = TypeMarker;
1150
1151/// The BIGINT column type (64-bit).
1152///
1153/// BIGINT (or INT8) stores 64-bit signed integers.
1154///
1155/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1156pub const BIGINT: TypeMarker = TypeMarker;
1157
1158/// Alias for BIGINT.
1159pub const INT8: TypeMarker = TypeMarker;
1160
1161/// The SMALLINT column type (16-bit).
1162///
1163/// SMALLINT (or INT2) stores 16-bit signed integers.
1164///
1165/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1166pub const SMALLINT: TypeMarker = TypeMarker;
1167
1168/// Alias for SMALLINT.
1169pub const INT2: TypeMarker = TypeMarker;
1170
1171//--- Floating Point Types ---
1172
1173/// The REAL column type (32-bit float).
1174///
1175/// REAL (or FLOAT4) stores 32-bit floating point numbers.
1176///
1177/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT>
1178pub const REAL: TypeMarker = TypeMarker;
1179
1180/// Alias for REAL.
1181pub const FLOAT4: TypeMarker = TypeMarker;
1182
1183/// The DOUBLE PRECISION column type (64-bit float).
1184///
1185/// DOUBLE PRECISION (or FLOAT8) stores 64-bit floating point numbers.
1186///
1187/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT>
1188pub const DOUBLE_PRECISION: TypeMarker = TypeMarker;
1189
1190/// Alias for DOUBLE PRECISION.
1191pub const FLOAT8: TypeMarker = TypeMarker;
1192
1193/// Alias for DOUBLE PRECISION.
1194pub const DOUBLE: TypeMarker = TypeMarker;
1195
1196/// The NUMERIC column type (arbitrary precision).
1197///
1198/// NUMERIC stores exact numbers with arbitrary precision.
1199///
1200/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL>
1201pub const NUMERIC: TypeMarker = TypeMarker;
1202
1203/// Alias for NUMERIC.
1204pub const DECIMAL: TypeMarker = TypeMarker;
1205
1206//--- Boolean Type ---
1207
1208/// The BOOLEAN column type.
1209///
1210/// BOOLEAN stores true/false values.
1211///
1212/// See: <https://www.postgresql.org/docs/current/datatype-boolean.html>
1213pub const BOOLEAN: TypeMarker = TypeMarker;
1214
1215/// Alias for BOOLEAN.
1216pub const BOOL: TypeMarker = TypeMarker;
1217
1218//--- Binary Type ---
1219
1220/// The BYTEA column type (binary data).
1221///
1222/// BYTEA stores variable-length binary strings.
1223///
1224/// See: <https://www.postgresql.org/docs/current/datatype-binary.html>
1225pub const BYTEA: TypeMarker = TypeMarker;
1226
1227//--- UUID Type ---
1228
1229/// The UUID column type.
1230///
1231/// UUID stores universally unique identifiers.
1232/// Requires the `uuid` feature.
1233///
1234/// See: <https://www.postgresql.org/docs/current/datatype-uuid.html>
1235pub const UUID: TypeMarker = TypeMarker;
1236
1237//--- Date/Time Types ---
1238
1239/// The TIMESTAMP column type (without timezone).
1240///
1241/// TIMESTAMP stores date and time without timezone.
1242///
1243/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1244pub const TIMESTAMP: TypeMarker = TypeMarker;
1245
1246/// Alias for TIMESTAMP.
1247pub const TIMESTAMP_WITHOUT_TIME_ZONE: TypeMarker = TypeMarker;
1248
1249/// The TIMESTAMPTZ column type (with timezone).
1250///
1251/// TIMESTAMPTZ stores date and time with timezone.
1252///
1253/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1254pub const TIMESTAMPTZ: TypeMarker = TypeMarker;
1255
1256/// Alias for TIMESTAMPTZ.
1257pub const TIMESTAMP_WITH_TIME_ZONE: TypeMarker = TypeMarker;
1258
1259/// The DATE column type.
1260///
1261/// DATE stores calendar dates without time.
1262///
1263/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1264pub const DATE: TypeMarker = TypeMarker;
1265
1266/// The TIME column type (without timezone).
1267///
1268/// TIME stores time of day without date or timezone.
1269///
1270/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1271pub const TIME: TypeMarker = TypeMarker;
1272
1273/// Alias for TIME.
1274pub const TIME_WITHOUT_TIME_ZONE: TypeMarker = TypeMarker;
1275
1276/// The TIMETZ column type (with timezone).
1277///
1278/// TIMETZ stores time of day with timezone.
1279///
1280/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1281pub const TIMETZ: TypeMarker = TypeMarker;
1282
1283/// Alias for TIMETZ.
1284pub const TIME_WITH_TIME_ZONE: TypeMarker = TypeMarker;
1285
1286/// The INTERVAL column type.
1287///
1288/// INTERVAL stores time intervals.
1289/// Requires the `chrono` feature.
1290///
1291/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1292pub const INTERVAL: TypeMarker = TypeMarker;
1293
1294//--- Network Address Types ---
1295
1296/// The INET column type.
1297///
1298/// INET stores IPv4 or IPv6 host addresses.
1299/// Requires the `cidr` feature.
1300///
1301/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1302pub const INET: TypeMarker = TypeMarker;
1303
1304/// The CIDR column type.
1305///
1306/// CIDR stores IPv4 or IPv6 network addresses.
1307/// Requires the `cidr` feature.
1308///
1309/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1310pub const CIDR: TypeMarker = TypeMarker;
1311
1312/// The MACADDR column type.
1313///
1314/// MACADDR stores MAC addresses.
1315/// Requires the `cidr` feature.
1316///
1317/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1318pub const MACADDR: TypeMarker = TypeMarker;
1319
1320/// The MACADDR8 column type.
1321///
1322/// MACADDR8 stores EUI-64 MAC addresses.
1323/// Requires the `cidr` feature.
1324///
1325/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1326pub const MACADDR8: TypeMarker = TypeMarker;
1327
1328//--- Geometric Types ---
1329
1330/// The POINT column type.
1331///
1332/// POINT stores geometric points.
1333/// Requires the `geo-types` feature.
1334///
1335/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1336pub const POINT: TypeMarker = TypeMarker;
1337
1338/// The LINE column type.
1339///
1340/// LINE stores infinite geometric lines.
1341/// Requires the `geo-types` feature.
1342///
1343/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1344pub const LINE: TypeMarker = TypeMarker;
1345
1346/// The LSEG column type.
1347///
1348/// LSEG stores geometric line segments.
1349/// Requires the `geo-types` feature.
1350///
1351/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1352pub const LSEG: TypeMarker = TypeMarker;
1353
1354/// The BOX column type.
1355///
1356/// BOX stores geometric boxes.
1357/// Requires the `geo-types` feature.
1358///
1359/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1360pub const BOX: TypeMarker = TypeMarker;
1361
1362/// The PATH column type.
1363///
1364/// PATH stores geometric paths.
1365/// Requires the `geo-types` feature.
1366///
1367/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1368pub const PATH: TypeMarker = TypeMarker;
1369
1370/// The POLYGON column type.
1371///
1372/// POLYGON stores geometric polygons.
1373/// Requires the `geo-types` feature.
1374///
1375/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1376pub const POLYGON: TypeMarker = TypeMarker;
1377
1378/// The CIRCLE column type.
1379///
1380/// CIRCLE stores geometric circles.
1381/// Requires the `geo-types` feature.
1382///
1383/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1384pub const CIRCLE: TypeMarker = TypeMarker;
1385
1386//--- Bit String Types ---
1387
1388/// The BIT column type.
1389///
1390/// BIT stores fixed-length bit strings.
1391/// Requires the `bit-vec` feature.
1392///
1393/// See: <https://www.postgresql.org/docs/current/datatype-bit.html>
1394pub const BIT: TypeMarker = TypeMarker;
1395
1396/// The VARBIT column type.
1397///
1398/// VARBIT (BIT VARYING) stores variable-length bit strings.
1399/// Requires the `bit-vec` feature.
1400///
1401/// See: <https://www.postgresql.org/docs/current/datatype-bit.html>
1402pub const VARBIT: TypeMarker = TypeMarker;
1403
1404/// Alias for VARBIT.
1405pub const BIT_VARYING: TypeMarker = TypeMarker;