Skip to main content

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