Skip to main content

uqa_sql/ast/
domains.rs

1//
2// Unified Query Algebra
3//
4// Copyright (c) 2023-2026 Cognica, Inc.
5//
6
7//! Domain declarations retain type identity and constraints until catalog binding.
8
9use serde::{Deserialize, Serialize};
10
11use super::{ColumnType, Expr};
12
13#[derive(Debug, Clone, Serialize, Deserialize)]
14pub struct CreateDomain {
15    pub name: String,
16    pub base: ColumnType,
17    pub collation: Option<String>,
18    pub default: Option<Expr>,
19    pub not_null: Option<DomainNotNull>,
20    pub checks: Vec<DomainCheck>,
21}
22
23#[derive(Debug, Clone, Serialize, Deserialize)]
24pub struct DomainNotNull {
25    pub name: Option<String>,
26}
27
28#[derive(Debug, Clone, Serialize, Deserialize)]
29pub struct DomainCheck {
30    pub name: Option<String>,
31    pub expression: Expr,
32}