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/// Sets the reverse relation accessor name on the referenced table.
361///
362/// By default, reverse relations are named from the source table
363/// (`posts` for a `Post` table). When multiple foreign keys target the
364/// same table — or the FK is self-referential — the name is disambiguated
365/// as `{forward}_{plural}` (e.g. `author_posts`). Use `relation` to pick
366/// an explicit reverse name instead.
367///
368/// The forward relation (on this table) is unchanged; only the reverse
369/// accessor on the referenced table is renamed.
370///
371/// # Examples
372/// ```rust
373/// # let _ = r####"
374/// // Users get `.authored()` instead of `.author_posts()`
375/// #[column(REFERENCES = User::id, RELATION = "authored")]
376/// author_id: i32,
377///
378/// // Still auto-disambiguated: Users get `.editor_posts()`
379/// #[column(REFERENCES = User::id)]
380/// editor_id: Option<i32>,
381/// # "####;
382/// ```
383///
384/// Requires a `REFERENCES` attribute on the same column.
385pub const RELATION: ColumnMarker = ColumnMarker;
386
387/// Specifies the ON DELETE action for foreign key references.
388///
389/// # Examples
390/// ```rust
391/// # let _ = r####"
392/// #[column(REFERENCES = User::id, ON_DELETE = CASCADE)]
393/// user_id: i32,
394/// # "####;
395/// ```
396///
397/// # Supported Actions
398/// - `CASCADE`: Delete rows that reference the deleted row
399/// - `SET_NULL`: Set the column to NULL when referenced row is deleted
400/// - `SET_DEFAULT`: Set the column to its default value
401/// - `RESTRICT`: Prevent deletion if referenced
402/// - `NO_ACTION`: Similar to RESTRICT (default)
403///
404/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
405pub const ON_DELETE: ColumnMarker = ColumnMarker;
406
407/// Specifies the ON UPDATE action for foreign key references.
408///
409/// # Examples
410/// ```rust
411/// # let _ = r####"
412/// #[column(REFERENCES = User::id, ON_UPDATE = CASCADE)]
413/// user_id: i32,
414/// # "####;
415/// ```
416///
417/// # Supported Actions
418/// - `CASCADE`: Update referencing rows when referenced row is updated
419/// - `SET_NULL`: Set the column to NULL when referenced row is updated
420/// - `SET_DEFAULT`: Set the column to its default value
421/// - `RESTRICT`: Prevent update if referenced
422/// - `NO_ACTION`: Similar to RESTRICT (default)
423///
424/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
425pub const ON_UPDATE: ColumnMarker = ColumnMarker;
426
427/// Marks a foreign key or table-level UNIQUE constraint as DEFERRABLE.
428///
429/// # Examples
430/// ```rust
431/// # let _ = r####"
432/// #[column(REFERENCES = Users::id, DEFERRABLE)]
433/// user_id: i32,
434///
435/// #[PostgresTable(UNIQUE(columns(email, tenant_id), deferrable))]
436/// struct Users {
437/// email: String,
438/// tenant_id: i32,
439/// }
440/// # "####;
441/// ```
442///
443/// See: <https://www.postgresql.org/docs/current/sql-createtable.html>
444pub const DEFERRABLE: ColumnMarker = ColumnMarker;
445
446/// Marks a foreign key or table-level UNIQUE constraint as DEFERRABLE INITIALLY DEFERRED.
447///
448/// # Examples
449/// ```rust
450/// # let _ = r####"
451/// #[column(REFERENCES = Users::id, INITIALLY_DEFERRED)]
452/// user_id: i32,
453///
454/// #[PostgresTable(UNIQUE(columns(email, tenant_id), initially_deferred))]
455/// struct Users {
456/// email: String,
457/// tenant_id: i32,
458/// }
459/// # "####;
460/// ```
461///
462/// See: <https://www.postgresql.org/docs/current/sql-createtable.html>
463pub const INITIALLY_DEFERRED: ColumnMarker = ColumnMarker;
464
465//------------------------------------------------------------------------------
466// Referential Action Values
467//------------------------------------------------------------------------------
468
469/// Type alias for referential action markers (uses `ColumnMarker` for macro compatibility).
470pub type ReferentialAction = ColumnMarker;
471
472/// CASCADE action: Propagate the delete/update to referencing rows.
473///
474/// # Examples
475/// ```rust
476/// # let _ = r####"
477/// #[column(REFERENCES = User::id, ON_DELETE = CASCADE)]
478/// user_id: i32,
479/// # "####;
480/// ```
481///
482/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
483pub const CASCADE: ColumnMarker = ColumnMarker;
484
485/// SET NULL action: Set referencing columns to NULL.
486///
487/// # Examples
488/// ```rust
489/// # let _ = r####"
490/// #[column(REFERENCES = User::id, ON_DELETE = SET_NULL)]
491/// user_id: Option<i32>,
492/// # "####;
493/// ```
494///
495/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
496pub const SET_NULL: ColumnMarker = ColumnMarker;
497
498/// SET DEFAULT action: Set referencing columns to their default values.
499///
500/// # Examples
501/// ```rust
502/// # let _ = r####"
503/// #[column(REFERENCES = User::id, ON_DELETE = SET_DEFAULT, DEFAULT = 0)]
504/// user_id: i32,
505/// # "####;
506/// ```
507///
508/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
509pub const SET_DEFAULT: ColumnMarker = ColumnMarker;
510
511/// RESTRICT action: Prevent delete/update if referenced.
512///
513/// # Examples
514/// ```rust
515/// # let _ = r####"
516/// #[column(REFERENCES = User::id, ON_DELETE = RESTRICT)]
517/// user_id: i32,
518/// # "####;
519/// ```
520///
521/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
522pub const RESTRICT: ColumnMarker = ColumnMarker;
523
524/// NO ACTION action: Similar to RESTRICT (default behavior).
525///
526/// # Examples
527/// ```rust
528/// # let _ = r####"
529/// #[column(REFERENCES = User::id, ON_DELETE = NO_ACTION)]
530/// user_id: i32,
531/// # "####;
532/// ```
533///
534/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
535pub const NO_ACTION: ColumnMarker = ColumnMarker;
536
537/// Adds a CHECK constraint to a column or table.
538///
539/// # Examples
540/// ```rust
541/// # let _ = r####"
542/// #[column(CHECK = "age >= 0")]
543/// age: i32,
544///
545/// #[PostgresTable(CHECK(name = "valid_score", expr = "score >= 0 AND score <= 100"))]
546/// struct Scores {
547/// score: i32,
548/// }
549/// # "####;
550/// ```
551///
552/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-CHECK-CONSTRAINTS>
553pub const CHECK: ColumnMarker = ColumnMarker;
554
555//------------------------------------------------------------------------------
556// Name Marker (shared by column and table attributes)
557//------------------------------------------------------------------------------
558
559/// Marker struct for the NAME attribute.
560#[derive(Debug, Clone, Copy)]
561pub struct NameMarker;
562
563/// Specifies a custom name in the database.
564///
565/// By default a table or view is named after its struct in `snake_case`, and
566/// a column after its field. Use `NAME` to choose another name.
567///
568/// # Examples
569/// ```rust
570/// # let _ = r####"
571/// // Column `creation_timestamp` instead of `created_at`:
572/// #[column(NAME = "creation_timestamp")]
573/// created_at: DateTime<Utc>,
574///
575/// // Table `user_accounts` instead of `user_account`:
576/// #[PostgresTable(NAME = "user_accounts")]
577/// struct UserAccount { ... }
578///
579/// #[PostgresView(NAME = "active_users")]
580/// struct ActiveUsers { ... }
581/// # "####;
582/// ```
583pub const NAME: NameMarker = NameMarker;
584
585//------------------------------------------------------------------------------
586// View Attribute Markers
587//------------------------------------------------------------------------------
588
589/// Marker struct for view attributes.
590#[derive(Debug, Clone, Copy)]
591pub struct ViewMarker;
592
593/// Specifies a view definition SQL string or expression.
594///
595/// # Examples
596/// ```rust
597/// # let _ = r####"
598/// #[PostgresView(DEFINITION = "SELECT id, name FROM users")]
599/// struct UserNames { id: i32, name: String }
600/// # "####;
601/// ```
602///
603/// ```rust
604/// # let _ = r####"
605/// #[PostgresView(
606/// DEFINITION = {
607/// let builder = drizzle::postgres::builder::QueryBuilder::new::<Schema>();
608/// let Schema { user } = Schema::new();
609/// builder.select((user.id, user.name)).from(user)
610/// }
611/// )]
612/// struct UserNames { id: i32, name: String }
613/// # "####;
614/// ```
615pub const DEFINITION: ViewMarker = ViewMarker;
616
617/// Specifies a table or view schema name.
618///
619/// # Examples
620/// ```rust
621/// # let _ = r####"
622/// #[PostgresView(SCHEMA = "auth")]
623/// struct AuthUsers { ... }
624///
625/// #[PostgresTable(SCHEMA = "auth")]
626/// struct AuthUsersTable { id: i32 }
627/// # "####;
628/// ```
629pub const SCHEMA: ViewMarker = ViewMarker;
630
631/// Marks the view as materialized.
632///
633/// # Examples
634/// ```rust
635/// # let _ = r####"
636/// #[PostgresView(MATERIALIZED)]
637/// struct ActiveUsers { ... }
638/// # "####;
639/// ```
640pub const MATERIALIZED: ViewMarker = ViewMarker;
641
642/// Sets WITH options for a view definition.
643///
644/// # Examples
645/// ```rust
646/// # let _ = r####"
647/// #[PostgresView(WITH = ViewWithOptionDef::new().security_barrier())]
648/// struct ActiveUsers { ... }
649/// # "####;
650/// ```
651pub const WITH: ViewMarker = ViewMarker;
652
653/// Alias for [`WITH`].
654pub const WITH_OPTIONS: ViewMarker = ViewMarker;
655
656/// Create a materialized view WITH NO DATA.
657///
658/// # Examples
659/// ```rust
660/// # let _ = r####"
661/// #[PostgresView(MATERIALIZED, WITH_NO_DATA)]
662/// struct ActiveUsers { ... }
663/// # "####;
664/// ```
665pub const WITH_NO_DATA: ViewMarker = ViewMarker;
666
667/// Specifies a USING clause for materialized views or row-level security policies.
668///
669/// # Examples
670/// ```rust
671/// # let _ = r####"
672/// #[PostgresView(USING = "heap")]
673/// struct ActiveUsers { ... }
674///
675/// #[PostgresPolicy(USING = "tenant_id = current_setting('app.tenant_id')::int")]
676/// struct TenantPolicy(Users);
677/// # "####;
678/// ```
679pub const USING: ViewMarker = ViewMarker;
680
681/// Marks the view as existing (skip creation).
682///
683/// # Examples
684/// ```rust
685/// # let _ = r####"
686/// #[PostgresView(EXISTING)]
687/// struct ExistingView { ... }
688/// # "####;
689/// ```
690pub const EXISTING: ViewMarker = ViewMarker;
691
692//------------------------------------------------------------------------------
693// Table Attribute Markers
694//------------------------------------------------------------------------------
695
696/// Marker struct for table-level attributes.
697#[derive(Debug, Clone, Copy)]
698pub struct TableMarker;
699
700/// Adds a table-level composite foreign key constraint.
701///
702/// # Examples
703/// ```rust
704/// # let _ = r####"
705/// #[PostgresTable(FOREIGN_KEY(
706/// columns(tenant_id, user_id),
707/// references(Users, tenant_id, id),
708/// on_delete = "CASCADE",
709/// deferrable
710/// ))]
711/// struct Posts {
712/// tenant_id: i32,
713/// user_id: i32,
714/// }
715/// # "####;
716/// ```
717///
718/// See: <https://www.postgresql.org/docs/current/ddl-constraints.html#DDL-CONSTRAINTS-FK>
719pub const FOREIGN_KEY: TableMarker = TableMarker;
720
721/// Creates an UNLOGGED table.
722///
723/// # Examples
724/// ```rust
725/// # mod drizzle {
726/// # pub mod core { pub use drizzle_core::*; }
727/// # pub mod error { pub use drizzle_core::error::*; }
728/// # pub mod types { pub use drizzle_types::*; }
729/// # pub mod migrations { pub use drizzle_migrations::*; }
730/// # pub use drizzle_types::Dialect;
731/// # pub use drizzle_types as ddl;
732/// # pub mod postgres {
733/// # pub mod values { pub use drizzle_postgres::values::*; }
734/// # pub mod traits { pub use drizzle_postgres::traits::*; }
735/// # pub mod common { pub use drizzle_postgres::common::*; }
736/// # pub mod attrs { pub use drizzle_postgres::attrs::*; }
737/// # pub mod builder { pub use drizzle_postgres::builder::*; }
738/// # pub mod helpers { pub use drizzle_postgres::helpers::*; }
739/// # pub mod expr { pub use drizzle_postgres::expr::*; }
740/// # pub mod types { pub use drizzle_postgres::types::*; }
741/// # #[cfg(feature = "aws-data-api")]
742/// # pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
743/// # pub struct Row;
744/// # impl Row {
745/// # pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
746/// # pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
747/// # }
748/// # pub mod prelude {
749/// # pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
750/// # pub use drizzle_postgres::attrs::*;
751/// # pub use drizzle_postgres::common::PostgresSchemaType;
752/// # pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
753/// # pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
754/// # pub use drizzle_core::*;
755/// # }
756/// # }
757/// # }
758/// use drizzle::postgres::prelude::*;
759///
760/// #[PostgresTable(UNLOGGED)]
761/// struct SessionCache {
762/// #[column(PRIMARY)]
763/// key: String,
764/// data: String,
765/// }
766/// ```
767///
768/// Unlogged tables are faster but data is not crash-safe.
769///
770/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-UNLOGGED>
771pub const UNLOGGED: TableMarker = TableMarker;
772
773/// Creates a TEMPORARY table.
774///
775/// # Examples
776/// ```rust
777/// # mod drizzle {
778/// # pub mod core { pub use drizzle_core::*; }
779/// # pub mod error { pub use drizzle_core::error::*; }
780/// # pub mod types { pub use drizzle_types::*; }
781/// # pub mod migrations { pub use drizzle_migrations::*; }
782/// # pub use drizzle_types::Dialect;
783/// # pub use drizzle_types as ddl;
784/// # pub mod postgres {
785/// # pub mod values { pub use drizzle_postgres::values::*; }
786/// # pub mod traits { pub use drizzle_postgres::traits::*; }
787/// # pub mod common { pub use drizzle_postgres::common::*; }
788/// # pub mod attrs { pub use drizzle_postgres::attrs::*; }
789/// # pub mod builder { pub use drizzle_postgres::builder::*; }
790/// # pub mod helpers { pub use drizzle_postgres::helpers::*; }
791/// # pub mod expr { pub use drizzle_postgres::expr::*; }
792/// # pub mod types { pub use drizzle_postgres::types::*; }
793/// # #[cfg(feature = "aws-data-api")]
794/// # pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
795/// # pub struct Row;
796/// # impl Row {
797/// # pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
798/// # pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
799/// # }
800/// # pub mod prelude {
801/// # pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
802/// # pub use drizzle_postgres::attrs::*;
803/// # pub use drizzle_postgres::common::PostgresSchemaType;
804/// # pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
805/// # pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
806/// # pub use drizzle_core::*;
807/// # }
808/// # }
809/// # }
810/// use drizzle::postgres::prelude::*;
811///
812/// #[PostgresTable(TEMPORARY)]
813/// struct TempData {
814/// id: i32,
815/// value: String,
816/// }
817/// ```
818///
819/// Temporary tables exist only for the current session.
820///
821/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-TEMPORARY>
822pub const TEMPORARY: TableMarker = TableMarker;
823
824/// Specifies inheritance from a parent table.
825///
826/// # Examples
827/// ```rust
828/// # mod drizzle {
829/// # pub mod core { pub use drizzle_core::*; }
830/// # pub mod error { pub use drizzle_core::error::*; }
831/// # pub mod types { pub use drizzle_types::*; }
832/// # pub mod migrations { pub use drizzle_migrations::*; }
833/// # pub use drizzle_types::Dialect;
834/// # pub use drizzle_types as ddl;
835/// # pub mod postgres {
836/// # pub mod values { pub use drizzle_postgres::values::*; }
837/// # pub mod traits { pub use drizzle_postgres::traits::*; }
838/// # pub mod common { pub use drizzle_postgres::common::*; }
839/// # pub mod attrs { pub use drizzle_postgres::attrs::*; }
840/// # pub mod builder { pub use drizzle_postgres::builder::*; }
841/// # pub mod helpers { pub use drizzle_postgres::helpers::*; }
842/// # pub mod expr { pub use drizzle_postgres::expr::*; }
843/// # pub mod types { pub use drizzle_postgres::types::*; }
844/// # #[cfg(feature = "aws-data-api")]
845/// # pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
846/// # pub struct Row;
847/// # impl Row {
848/// # pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
849/// # pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
850/// # }
851/// # pub mod prelude {
852/// # pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
853/// # pub use drizzle_postgres::attrs::*;
854/// # pub use drizzle_postgres::common::PostgresSchemaType;
855/// # pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
856/// # pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
857/// # pub use drizzle_core::*;
858/// # }
859/// # }
860/// # }
861/// use drizzle::postgres::prelude::*;
862///
863/// #[PostgresTable(INHERITS = "base_table")]
864/// struct ChildTable {
865/// extra_field: String,
866/// }
867/// ```
868///
869/// See: <https://www.postgresql.org/docs/current/ddl-inherit.html>
870pub const INHERITS: TableMarker = TableMarker;
871
872/// Specifies a tablespace for the table.
873///
874/// # Examples
875/// ```rust
876/// # mod drizzle {
877/// # pub mod core { pub use drizzle_core::*; }
878/// # pub mod error { pub use drizzle_core::error::*; }
879/// # pub mod types { pub use drizzle_types::*; }
880/// # pub mod migrations { pub use drizzle_migrations::*; }
881/// # pub use drizzle_types::Dialect;
882/// # pub use drizzle_types as ddl;
883/// # pub mod postgres {
884/// # pub mod values { pub use drizzle_postgres::values::*; }
885/// # pub mod traits { pub use drizzle_postgres::traits::*; }
886/// # pub mod common { pub use drizzle_postgres::common::*; }
887/// # pub mod attrs { pub use drizzle_postgres::attrs::*; }
888/// # pub mod builder { pub use drizzle_postgres::builder::*; }
889/// # pub mod helpers { pub use drizzle_postgres::helpers::*; }
890/// # pub mod expr { pub use drizzle_postgres::expr::*; }
891/// # pub mod types { pub use drizzle_postgres::types::*; }
892/// # #[cfg(feature = "aws-data-api")]
893/// # pub mod aws_data_api { pub use drizzle_postgres::aws_data_api::*; }
894/// # pub struct Row;
895/// # impl Row {
896/// # pub fn get<'a, I, T>(&'a self, _: I) -> T { unimplemented!() }
897/// # pub fn try_get<'a, I, T>(&'a self, _: I) -> Result<T, Box<dyn std::error::Error + Sync + Send>> { unimplemented!() }
898/// # }
899/// # pub mod prelude {
900/// # pub use drizzle_macros::{PostgresTable, PostgresSchema, PostgresIndex};
901/// # pub use drizzle_postgres::attrs::*;
902/// # pub use drizzle_postgres::common::PostgresSchemaType;
903/// # pub use drizzle_postgres::traits::{PostgresColumn, PostgresTable};
904/// # pub use drizzle_postgres::values::{PostgresInsertValue, PostgresUpdateValue, PostgresValue};
905/// # pub use drizzle_core::*;
906/// # }
907/// # }
908/// # }
909/// use drizzle::postgres::prelude::*;
910///
911/// #[PostgresTable(TABLESPACE = "fast_storage")]
912/// struct HighPerfTable {
913/// #[column(PRIMARY)]
914/// id: i32,
915/// }
916///
917/// // Views also support TABLESPACE:
918/// // #[PostgresView(MATERIALIZED, TABLESPACE = "fast_storage")]
919/// // struct ActiveUsers { id: i32 }
920/// ```
921///
922/// See: <https://www.postgresql.org/docs/current/sql-createtable.html#SQL-CREATETABLE-TABLESPACE>
923pub const TABLESPACE: TableMarker = TableMarker;
924
925/// Enables row-level security for the table.
926///
927/// # Examples
928/// ```rust
929/// # let _ = r####"
930/// #[PostgresTable(RLS)]
931/// struct Users {
932/// id: i32,
933/// }
934/// # "####;
935/// ```
936///
937/// See: <https://www.postgresql.org/docs/current/ddl-rowsecurity.html>
938pub const RLS: TableMarker = TableMarker;
939
940//------------------------------------------------------------------------------
941// Index Attribute Markers
942//------------------------------------------------------------------------------
943
944/// Marker struct for index attributes.
945#[derive(Debug, Clone, Copy)]
946pub struct IndexMarker;
947
948/// Creates or drops an index CONCURRENTLY.
949///
950/// # Examples
951/// ```rust
952/// # let _ = r####"
953/// #[PostgresIndex(concurrent)]
954/// struct UsersEmailIdx(Users::email);
955/// # "####;
956/// ```
957///
958/// See: <https://www.postgresql.org/docs/current/sql-createindex.html>
959pub const CONCURRENT: IndexMarker = IndexMarker;
960
961/// Specifies the index access method.
962///
963/// # Examples
964/// ```rust
965/// # let _ = r####"
966/// #[PostgresIndex(method = "gin")]
967/// struct DocumentsSearchIdx(Documents::search_vector);
968/// # "####;
969/// ```
970///
971/// See: <https://www.postgresql.org/docs/current/indexes-types.html>
972pub const METHOD: IndexMarker = IndexMarker;
973
974/// Specifies a partial-index predicate as raw PostgreSQL SQL.
975///
976/// Use database column names in the predicate. Rust field or column renames do
977/// not rewrite this string.
978///
979/// # Examples
980/// ```rust
981/// # let _ = r####"
982/// #[PostgresIndex(where = "deleted_at IS NULL")]
983/// struct ActiveUsersEmailIdx(Users::email);
984/// # "####;
985/// ```
986///
987/// See: <https://www.postgresql.org/docs/current/indexes-partial.html>
988pub const WHERE: IndexMarker = IndexMarker;
989
990//------------------------------------------------------------------------------
991// Policy Attribute Markers
992//------------------------------------------------------------------------------
993
994/// Marker struct for row-level security policy attributes.
995#[derive(Debug, Clone, Copy)]
996pub struct PolicyMarker;
997
998/// Specifies whether a policy is PERMISSIVE or RESTRICTIVE.
999///
1000/// # Examples
1001/// ```rust
1002/// # let _ = r####"
1003/// #[PostgresPolicy(AS = "RESTRICTIVE")]
1004/// struct TenantPolicy(Users);
1005/// # "####;
1006/// ```
1007///
1008/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1009pub const AS: PolicyMarker = PolicyMarker;
1010
1011/// Alias for [`AS`].
1012pub const AS_CLAUSE: PolicyMarker = PolicyMarker;
1013
1014/// Specifies the command a policy applies to.
1015///
1016/// # Examples
1017/// ```rust
1018/// # let _ = r####"
1019/// #[PostgresPolicy(FOR = "SELECT")]
1020/// struct ReadPolicy(Users);
1021/// # "####;
1022/// ```
1023///
1024/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1025pub const FOR: PolicyMarker = PolicyMarker;
1026
1027/// Alias for [`FOR`].
1028pub const FOR_CLAUSE: PolicyMarker = PolicyMarker;
1029
1030/// Specifies roles the policy applies to.
1031///
1032/// # Examples
1033/// ```rust
1034/// # let _ = r####"
1035/// #[PostgresPolicy(TO("app_user", public))]
1036/// struct TenantPolicy(Users);
1037/// # "####;
1038/// ```
1039///
1040/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1041pub const TO: PolicyMarker = PolicyMarker;
1042
1043/// Specifies a WITH CHECK expression for INSERT/UPDATE policies.
1044///
1045/// # Examples
1046/// ```rust
1047/// # let _ = r####"
1048/// #[PostgresPolicy(WITH_CHECK = "tenant_id = current_setting('app.tenant_id')::int")]
1049/// struct TenantWritePolicy(Users);
1050/// # "####;
1051/// ```
1052///
1053/// See: <https://www.postgresql.org/docs/current/sql-createpolicy.html>
1054pub const WITH_CHECK: PolicyMarker = PolicyMarker;
1055
1056//------------------------------------------------------------------------------
1057// Column Type Markers
1058//------------------------------------------------------------------------------
1059
1060/// Marker struct for `PostgreSQL` column type names.
1061///
1062/// `#[PostgresTable]` infers each column's SQL type from its Rust field type.
1063/// Of these names, only `VARCHAR(n)` and `CHAR(n)` can be written in
1064/// `#[column(...)]`; the rest document the types the macro can produce.
1065#[derive(Debug, Clone, Copy)]
1066pub struct TypeMarker;
1067
1068//--- Character Types ---
1069
1070/// The TEXT column type.
1071///
1072/// TEXT stores variable-length character strings with no length limit.
1073///
1074/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1075pub const TEXT: TypeMarker = TypeMarker;
1076
1077/// The VARCHAR column type.
1078///
1079/// VARCHAR stores variable-length character strings.
1080/// In `PostgreSQL`, VARCHAR without length limit is equivalent to TEXT.
1081/// Use `#[column(VARCHAR(255))]` to preserve a bounded physical column while
1082/// keeping the Rust field type as `String`; `Vec<String>` preserves the same
1083/// bound for each array element.
1084///
1085/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1086pub const VARCHAR: TypeMarker = TypeMarker;
1087
1088/// Another name for VARCHAR; write `VARCHAR(n)` in `#[column(...)]`.
1089pub const CHARACTER_VARYING: TypeMarker = TypeMarker;
1090
1091/// The CHAR column type.
1092///
1093/// CHAR stores fixed-length character strings.
1094/// Use `#[column(CHAR(8))]` to declare its required physical length. The same
1095/// marker on `Vec<String>` declares an array of bounded CHAR elements.
1096///
1097/// See: <https://www.postgresql.org/docs/current/datatype-character.html>
1098pub const CHAR: TypeMarker = TypeMarker;
1099
1100/// Another name for CHAR; write `CHAR(n)` in `#[column(...)]`.
1101pub const CHARACTER: TypeMarker = TypeMarker;
1102
1103//--- Integer Types ---
1104
1105/// The INTEGER column type (32-bit).
1106///
1107/// INTEGER (or INT4) stores 32-bit signed integers.
1108///
1109/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1110pub const INTEGER: TypeMarker = TypeMarker;
1111
1112/// Alias for INTEGER.
1113pub const INT: TypeMarker = TypeMarker;
1114
1115/// Alias for INTEGER.
1116pub const INT4: TypeMarker = TypeMarker;
1117
1118/// The BIGINT column type (64-bit).
1119///
1120/// BIGINT (or INT8) stores 64-bit signed integers.
1121///
1122/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1123pub const BIGINT: TypeMarker = TypeMarker;
1124
1125/// Alias for BIGINT.
1126pub const INT8: TypeMarker = TypeMarker;
1127
1128/// The SMALLINT column type (16-bit).
1129///
1130/// SMALLINT (or INT2) stores 16-bit signed integers.
1131///
1132/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-INT>
1133pub const SMALLINT: TypeMarker = TypeMarker;
1134
1135/// Alias for SMALLINT.
1136pub const INT2: TypeMarker = TypeMarker;
1137
1138//--- Floating Point Types ---
1139
1140/// The REAL column type (32-bit float).
1141///
1142/// REAL (or FLOAT4) stores 32-bit floating point numbers.
1143///
1144/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT>
1145pub const REAL: TypeMarker = TypeMarker;
1146
1147/// Alias for REAL.
1148pub const FLOAT4: TypeMarker = TypeMarker;
1149
1150/// The DOUBLE PRECISION column type (64-bit float).
1151///
1152/// DOUBLE PRECISION (or FLOAT8) stores 64-bit floating point numbers.
1153///
1154/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-FLOAT>
1155pub const DOUBLE_PRECISION: TypeMarker = TypeMarker;
1156
1157/// Alias for DOUBLE PRECISION.
1158pub const FLOAT8: TypeMarker = TypeMarker;
1159
1160/// Alias for DOUBLE PRECISION.
1161pub const DOUBLE: TypeMarker = TypeMarker;
1162
1163/// The NUMERIC column type (arbitrary precision).
1164///
1165/// NUMERIC stores exact numbers with arbitrary precision.
1166///
1167/// See: <https://www.postgresql.org/docs/current/datatype-numeric.html#DATATYPE-NUMERIC-DECIMAL>
1168pub const NUMERIC: TypeMarker = TypeMarker;
1169
1170/// Alias for NUMERIC.
1171pub const DECIMAL: TypeMarker = TypeMarker;
1172
1173//--- Boolean Type ---
1174
1175/// The BOOLEAN column type.
1176///
1177/// BOOLEAN stores true/false values.
1178///
1179/// See: <https://www.postgresql.org/docs/current/datatype-boolean.html>
1180pub const BOOLEAN: TypeMarker = TypeMarker;
1181
1182/// Alias for BOOLEAN.
1183pub const BOOL: TypeMarker = TypeMarker;
1184
1185//--- Binary Type ---
1186
1187/// The BYTEA column type (binary data).
1188///
1189/// BYTEA stores variable-length binary strings.
1190///
1191/// See: <https://www.postgresql.org/docs/current/datatype-binary.html>
1192pub const BYTEA: TypeMarker = TypeMarker;
1193
1194//--- UUID Type ---
1195
1196/// The UUID column type.
1197///
1198/// UUID stores universally unique identifiers.
1199/// Requires the `uuid` feature.
1200///
1201/// See: <https://www.postgresql.org/docs/current/datatype-uuid.html>
1202pub const UUID: TypeMarker = TypeMarker;
1203
1204//--- Date/Time Types ---
1205
1206/// The TIMESTAMP column type (without timezone).
1207///
1208/// TIMESTAMP stores date and time without timezone.
1209///
1210/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1211pub const TIMESTAMP: TypeMarker = TypeMarker;
1212
1213/// Alias for TIMESTAMP.
1214pub const TIMESTAMP_WITHOUT_TIME_ZONE: TypeMarker = TypeMarker;
1215
1216/// The TIMESTAMPTZ column type (with timezone).
1217///
1218/// TIMESTAMPTZ stores date and time with timezone.
1219///
1220/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1221pub const TIMESTAMPTZ: TypeMarker = TypeMarker;
1222
1223/// Alias for TIMESTAMPTZ.
1224pub const TIMESTAMP_WITH_TIME_ZONE: TypeMarker = TypeMarker;
1225
1226/// The DATE column type.
1227///
1228/// DATE stores calendar dates without time.
1229///
1230/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1231pub const DATE: TypeMarker = TypeMarker;
1232
1233/// The TIME column type (without timezone).
1234///
1235/// TIME stores time of day without date or timezone.
1236///
1237/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1238pub const TIME: TypeMarker = TypeMarker;
1239
1240/// Alias for TIME.
1241pub const TIME_WITHOUT_TIME_ZONE: TypeMarker = TypeMarker;
1242
1243/// The TIMETZ column type (with timezone).
1244///
1245/// TIMETZ stores time of day with timezone.
1246///
1247/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1248pub const TIMETZ: TypeMarker = TypeMarker;
1249
1250/// Alias for TIMETZ.
1251pub const TIME_WITH_TIME_ZONE: TypeMarker = TypeMarker;
1252
1253/// The INTERVAL column type.
1254///
1255/// INTERVAL stores time intervals.
1256/// Requires the `chrono` feature.
1257///
1258/// See: <https://www.postgresql.org/docs/current/datatype-datetime.html>
1259pub const INTERVAL: TypeMarker = TypeMarker;
1260
1261//--- Network Address Types ---
1262
1263/// The INET column type.
1264///
1265/// INET stores IPv4 or IPv6 host addresses.
1266/// Requires the `cidr` feature.
1267///
1268/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1269pub const INET: TypeMarker = TypeMarker;
1270
1271/// The CIDR column type.
1272///
1273/// CIDR stores IPv4 or IPv6 network addresses.
1274/// Requires the `cidr` feature.
1275///
1276/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1277pub const CIDR: TypeMarker = TypeMarker;
1278
1279/// The MACADDR column type.
1280///
1281/// MACADDR stores MAC addresses.
1282/// Requires the `cidr` feature.
1283///
1284/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1285pub const MACADDR: TypeMarker = TypeMarker;
1286
1287/// The MACADDR8 column type.
1288///
1289/// MACADDR8 stores EUI-64 MAC addresses.
1290/// Requires the `cidr` feature.
1291///
1292/// See: <https://www.postgresql.org/docs/current/datatype-net-types.html>
1293pub const MACADDR8: TypeMarker = TypeMarker;
1294
1295//--- Geometric Types ---
1296
1297/// The POINT column type.
1298///
1299/// POINT stores geometric points.
1300/// Requires the `geo-types` feature.
1301///
1302/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1303pub const POINT: TypeMarker = TypeMarker;
1304
1305/// The LINE column type.
1306///
1307/// LINE stores infinite geometric lines.
1308/// Requires the `geo-types` feature.
1309///
1310/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1311pub const LINE: TypeMarker = TypeMarker;
1312
1313/// The LSEG column type.
1314///
1315/// LSEG stores geometric line segments.
1316/// Requires the `geo-types` feature.
1317///
1318/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1319pub const LSEG: TypeMarker = TypeMarker;
1320
1321/// The BOX column type.
1322///
1323/// BOX stores geometric boxes.
1324/// Requires the `geo-types` feature.
1325///
1326/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1327pub const BOX: TypeMarker = TypeMarker;
1328
1329/// The PATH column type.
1330///
1331/// PATH stores geometric paths.
1332/// Requires the `geo-types` feature.
1333///
1334/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1335pub const PATH: TypeMarker = TypeMarker;
1336
1337/// The POLYGON column type.
1338///
1339/// POLYGON stores geometric polygons.
1340/// Requires the `geo-types` feature.
1341///
1342/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1343pub const POLYGON: TypeMarker = TypeMarker;
1344
1345/// The CIRCLE column type.
1346///
1347/// CIRCLE stores geometric circles.
1348/// Requires the `geo-types` feature.
1349///
1350/// See: <https://www.postgresql.org/docs/current/datatype-geometric.html>
1351pub const CIRCLE: TypeMarker = TypeMarker;
1352
1353//--- Bit String Types ---
1354
1355/// The BIT column type.
1356///
1357/// BIT stores fixed-length bit strings.
1358/// Requires the `bit-vec` feature.
1359///
1360/// See: <https://www.postgresql.org/docs/current/datatype-bit.html>
1361pub const BIT: TypeMarker = TypeMarker;
1362
1363/// The VARBIT column type.
1364///
1365/// VARBIT (BIT VARYING) stores variable-length bit strings.
1366/// Requires the `bit-vec` feature.
1367///
1368/// See: <https://www.postgresql.org/docs/current/datatype-bit.html>
1369pub const VARBIT: TypeMarker = TypeMarker;
1370
1371/// Alias for VARBIT.
1372pub const BIT_VARYING: TypeMarker = TypeMarker;