Skip to main content

qcraft_core/render/
policy.rs

1/// What to do when a feature is not supported by the target dialect.
2#[derive(Debug, Clone, Copy, PartialEq, Eq)]
3pub enum UnsupportedPolicy {
4    /// Silently skip the feature.
5    Ignore,
6    /// Skip the feature but record a warning.
7    Warn,
8    /// Return an error and stop rendering.
9    Error,
10}
11
12/// A warning emitted when a feature is skipped.
13#[derive(Debug, Clone)]
14pub struct Warning {
15    pub feature: &'static str,
16    pub message: String,
17}
18
19/// Known features that may be unsupported by some dialects.
20#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
21pub enum Feature {
22    // Table-level
23    IfNotExists,
24    Temporary,
25    Unlogged,
26    Tablespace,
27    Inherits,
28    PartitionBy,
29    TableComment,
30
31    // Column-level
32    ColumnCollation,
33    ColumnComment,
34    ColumnStorage,
35    ColumnCompression,
36    GeneratedVirtual,
37    GeneratedStored,
38    Identity,
39
40    // Constraints
41    Deferrable,
42    CheckNoInherit,
43    CheckEnforced,
44    NullsDistinct,
45    ExclusionConstraint,
46    ForeignKeyOnUpdate,
47    ForeignKeyMatchType,
48    ConstraintNotValid,
49    ValidateConstraint,
50    RenameConstraint,
51
52    // Index
53    IndexIfNotExists,
54    IndexConcurrently,
55    IndexOnline,
56    IndexType,
57    IndexInclude,
58    IndexPartialWhere,
59    IndexExpressionColumn,
60    IndexNullsOrder,
61    IndexOperatorClass,
62    IndexParameters,
63    IndexTablespace,
64    IndexInvisible,
65
66    // Alter table
67    AlterColumnType,
68    AlterColumnDefault,
69    AlterColumnNullability,
70    AddConstraint,
71    DropConstraint,
72    ColumnPosition,
73
74    // Drop table
75    DropCascade,
76    DropRestrict,
77
78    // Drop index
79    DropIndexConcurrently,
80    DropIndexCascade,
81
82    // Extensions
83    CreateExtension,
84    DropExtension,
85}