pub struct MySqlProjectionGenerator { /* private fields */ }Expand description
MySQL SQL projection generator.
MySQL uses JSON_OBJECT() for field projection, similar to PostgreSQL’s jsonb_build_object().
Generates efficient SQL that projects only requested JSON fields.
§Example
use fraiseql_core::db::projection_generator::MySqlProjectionGenerator;
let generator = MySqlProjectionGenerator::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 MySqlProjectionGenerator
impl MySqlProjectionGenerator
Sourcepub fn new() -> Self
pub fn new() -> Self
Create new MySQL 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 MySqlProjectionGenerator
impl RefUnwindSafe for MySqlProjectionGenerator
impl Send for MySqlProjectionGenerator
impl Sync for MySqlProjectionGenerator
impl Unpin for MySqlProjectionGenerator
impl UnsafeUnpin for MySqlProjectionGenerator
impl UnwindSafe for MySqlProjectionGenerator
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