pub struct SqliteProjectionGenerator { /* private fields */ }Expand description
SQLite SQL projection generator.
SQLite’s JSON support is more limited than PostgreSQL and MySQL.
Uses json_object() with json_extract() to project fields.
§Example
use fraiseql_core::db::projection_generator::SqliteProjectionGenerator;
let generator = SqliteProjectionGenerator::new();
let fields = vec!["id".to_string(), "name".to_string()];
let sql = generator.generate_projection_sql(&fields).unwrap();
assert!(sql.contains("json_object"));Implementations§
Source§impl SqliteProjectionGenerator
impl SqliteProjectionGenerator
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new SQLite projection generator with default JSON column name.
Default JSON column: “data”
Sourcepub fn with_column(json_column: &str) -> Self
pub fn with_column(json_column: &str) -> Self
Create projection generator with custom JSON column name.
§Arguments
json_column- Name of the JSON column in the database table
Sourcepub fn generate_projection_sql(&self, fields: &[String]) -> Result<String>
pub fn generate_projection_sql(&self, fields: &[String]) -> Result<String>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SqliteProjectionGenerator
impl RefUnwindSafe for SqliteProjectionGenerator
impl Send for SqliteProjectionGenerator
impl Sync for SqliteProjectionGenerator
impl Unpin for SqliteProjectionGenerator
impl UnsafeUnpin for SqliteProjectionGenerator
impl UnwindSafe for SqliteProjectionGenerator
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