pub enum Backend {
Mysql,
Postgres,
Sqlite,
}Expand description
支持的数据库后端
Variants§
Implementations§
Source§impl Backend
impl Backend
Sourcepub fn quote_ident(&self, ident: &str) -> String
pub fn quote_ident(&self, ident: &str) -> String
双重引号标识符
Sourcepub fn double_type(&self) -> &'static str
pub fn double_type(&self) -> &'static str
双精度浮点类型名(§9.7「数值归 double」)
SUM/AVG 的结果在不同后端原生精度不同:MySQL AVG(<int 列>) 只保留 4 位小数
(DECIMAL(scale+4)),PG AVG(<int 列>) 返回精确 numeric,均与 Mongo $avg
的 IEEE-754 double 存在差异。故 SQL 侧 AVG 前先把入参 CAST 到双精度。
Sourcepub fn qualified_table(&self, namespace: Option<&str>, table: &str) -> String
pub fn qualified_table(&self, namespace: Option<&str>, table: &str) -> String
表名 → SQL:namespace 可选限定(Some(ns) → "ns"."table";None → "table")
namespace 与连接的 search_path / 连接库 / ATTACH 库对应(见
multi-datasource-routing-plan.md §二);空串按 None 处理。
Sourcepub fn placeholder(&self, _index: usize) -> String
pub fn placeholder(&self, _index: usize) -> String
占位符:SQLite/MySQL 用 ?,PostgreSQL 用 $n(调用方保证按顺序传入 index)
Sourcepub fn supports_returning(&self) -> bool
pub fn supports_returning(&self) -> bool
MySQL 无 RETURNING —— 需由 Host 编排 UPDATE + find 两段;PG/SQLite 原生支持
Trait Implementations§
impl Copy for Backend
impl Eq for Backend
impl StructuralPartialEq for Backend
Auto Trait Implementations§
impl Freeze for Backend
impl RefUnwindSafe for Backend
impl Send for Backend
impl Sync for Backend
impl Unpin for Backend
impl UnsafeUnpin for Backend
impl UnwindSafe for Backend
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