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