pub struct RowCol {
pub alias: String,
pub json_path: Vec<String>,
pub is_array: bool,
pub one: bool,
pub ones: Vec<bool>,
pub sub_shape: Option<RowShape>,
pub always: bool,
pub is_bool: bool,
pub is_json: bool,
}Fields§
§alias: String§json_path: Vec<String>§is_array: bool是否为关系聚合数组字段(many 关系的子文档)
one: bool是否为 one 关系(LEFT JOIN 后还原为对象或 null,而非数组)
ones: Vec<bool>沿 json_path 每一级关系的基数(true = one)。长度 = 关系级数
(json_path.len() - 1);根标量列为空。嵌套关系靠它逐级决定「对象 / 数组」。
sub_shape: Option<RowShape>若为空:标量直接取该列;若非空:构造子文档
always: bool值恒「存在」:为 null 时也强制写入(不依赖 __present 哨兵)。用于归一聚合
计算列(§9.2(2))—— 空集 $sum/$avg/$min/$max 的语义是显式 null(§9.7),
与 Mongo 输出逐行对齐。
is_bool: bool§9.7「布尔归一」:该输出列对应 schema 的 boolean 字段 → 行还原时把 SQL 的
0/1 归一为 JSON bool(对齐 Mongo;PG 原生 BOOLEAN 已是 bool,归一为 no-op)。
依据schema 声明类型而非驱动元数据,故对任意用户 DDL 都成立。
is_json: boolJSON 列(object/array 字段落单列存 JSON 文本):行还原时把列值(JSON 文本字符串) 解析为嵌套 JSON 值,跨后端对齐 Mongo 的嵌套文档(见执行文档 §4.5 / 不足清单 #3)。
Implementations§
Source§impl RowCol
impl RowCol
pub fn scalar(alias: &str, path: &[&str]) -> Self
Sourcepub fn scalar_bool(alias: &str, path: &[&str], is_bool: bool) -> Self
pub fn scalar_bool(alias: &str, path: &[&str], is_bool: bool) -> Self
标量列 + 布尔标记(§9.7):来自 schema boolean 字段的输出列
Sourcepub fn computed(alias: &str, path: &[&str]) -> Self
pub fn computed(alias: &str, path: &[&str]) -> Self
归一聚合计算列(§9.2(2)):根标量,且 null 也强制写入(见 RowCol::always)
pub fn array(alias: &str, sub_shape: RowShape) -> Self
Trait Implementations§
impl StructuralPartialEq for RowCol
Auto Trait Implementations§
impl Freeze for RowCol
impl RefUnwindSafe for RowCol
impl Send for RowCol
impl Sync for RowCol
impl Unpin for RowCol
impl UnsafeUnpin for RowCol
impl UnwindSafe for RowCol
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more