1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
//! The logical cast: what a cast is once names are resolved and OIDs are gone.
//!
//! Loading lives in `catalog::raw::cast`.
use super::id::{DbObjectId, DependsOn};
/// A user-defined PostgreSQL cast (`CREATE CAST`).
///
/// Casts are not schema-scoped; their identity is the (source type, target type)
/// pair. `source` and `target` are canonical `format_type` names.
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Cast {
pub source: String,
pub target: String,
/// The full reconstructed `CREATE CAST` statement (no trailing `;`).
pub definition: String,
pub comment: Option<String>,
pub depends_on: Vec<DbObjectId>,
}
impl Cast {
pub fn id(&self) -> DbObjectId {
DbObjectId::Cast {
source: self.source.clone(),
target: self.target.clone(),
}
}
}
impl DependsOn for Cast {
fn id(&self) -> DbObjectId {
DbObjectId::Cast {
source: self.source.clone(),
target: self.target.clone(),
}
}
fn depends_on(&self) -> &[DbObjectId] {
&self.depends_on
}
}