Skip to main content

RowCol

Struct RowCol 

Source
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: bool

JSON 列(object/array 字段落单列存 JSON 文本):行还原时把列值(JSON 文本字符串) 解析为嵌套 JSON 值,跨后端对齐 Mongo 的嵌套文档(见执行文档 §4.5 / 不足清单 #3)。

Implementations§

Source§

impl RowCol

Source

pub fn scalar(alias: &str, path: &[&str]) -> Self

Source

pub fn scalar_bool(alias: &str, path: &[&str], is_bool: bool) -> Self

标量列 + 布尔标记(§9.7):来自 schema boolean 字段的输出列

Source

pub fn json(alias: &str, path: &[&str]) -> Self

JSON 列(object/array 字段):还原时把 JSON 文本解析为嵌套值

Source

pub fn computed(alias: &str, path: &[&str]) -> Self

归一聚合计算列(§9.2(2)):根标量,且 null 也强制写入(见 RowCol::always)

Source

pub fn array(alias: &str, sub_shape: RowShape) -> Self

Trait Implementations§

Source§

impl Clone for RowCol

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RowCol

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RowCol

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RowCol

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.