pub struct View {
pub docs: Vec<String>,
pub name: String,
pub name_span: SourceSpan,
pub sources: Vec<ViewSource>,
pub fields: Vec<Field>,
pub attributes: Vec<Attribute>,
pub span: SourceSpan,
}Fields§
§docs: Vec<String>§name: String§name_span: SourceSpan§sources: Vec<ViewSource>The from <Model>, <Model>, ... dependency list. Source model
names are stored as raw identifiers — the validator resolves
them against the schema’s models. Carries spans so error
reporting can point at the offending identifier.
fields: Vec<Field>§attributes: Vec<Attribute>Block-level attributes — @@server_sql, @@embedded_sql,
@@sql, @@materialized, @@no_unique, @@allow("read", …).
Stored raw; helper methods below extract typed views.
span: SourceSpanImplementations§
Source§impl View
impl View
Sourcepub fn server_sql(&self) -> Option<&str>
pub fn server_sql(&self) -> Option<&str>
Returns the SQL body declared via @@server_sql("…"), or the
@@sql("…") shorthand if no backend-specific body is set.
None means the view is embedded-only.
Sourcepub fn embedded_sql(&self) -> Option<&str>
pub fn embedded_sql(&self) -> Option<&str>
Returns the SQL body declared via @@embedded_sql("…"), or the
@@sql("…") shorthand if no backend-specific body is set.
None means the view is server-only.
Sourcepub fn is_materialized(&self) -> bool
pub fn is_materialized(&self) -> bool
true if the view was declared with @@materialized.
Materialized views are server-only — the embedded composer
emits a hard compile error when it encounters one.