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