pub struct Schema {
pub name: String,
pub collection: String,
pub id_prefix: String,
pub timestamps: bool,
pub fields: HashMap<String, FieldDef>,
pub relations: HashMap<String, RelationDef>,
pub computes: Vec<(String, ComputeDef)>,
pub read: Option<Vec<String>>,
pub write: Option<Vec<String>>,
pub indexes: Vec<Value>,
pub datasource: Option<String>,
pub namespace: Option<String>,
}Fields§
§name: String§collection: String§id_prefix: String§timestamps: bool§fields: HashMap<String, FieldDef>§relations: HashMap<String, RelationDef>§computes: Vec<(String, ComputeDef)>保持注册顺序:build_agg_stages 的输出顺序依赖它
read: Option<Vec<String>>§write: Option<Vec<String>>§indexes: Vec<Value>原始索引定义([{keys: {...}, options: {...}}]),upsert 条件构建依赖 unique 索引
datasource: Option<String>绑定的数据源名(可选;缺省 = default,回落单源 Mongo)。见 crate::datasource
namespace: Option<String>连接内的库/schema 名(可选;缺省 = null,用连接自身默认:Mongo db 实例的库名、
PG 的 search_path、MySQL 的连接库、SQLite 的 main)。
与 datasource/collection 构成定位三元组,见 super::Registry::get_by_location。
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Schema
impl RefUnwindSafe for Schema
impl Send for Schema
impl Sync for Schema
impl Unpin for Schema
impl UnsafeUnpin for Schema
impl UnwindSafe for Schema
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