#[non_exhaustive]pub struct SqlProjectionHint {
pub database: DatabaseType,
pub projection_template: String,
pub estimated_reduction_percent: u32,
}Expand description
SQL projection hint for database-specific field projection optimization.
When a type has a large JSONB payload, the compiler can generate SQL that projects only the requested fields, reducing network payload and JSON deserialization overhead.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.database: DatabaseTypeDatabase type — typed to prevent silent typos (e.g. "postgresq") that
would cause adapters to silently ignore the hint.
projection_template: StringThe projection SQL template.
Example for PostgreSQL:
jsonb_build_object('id', data->>'id', 'email', data->>'email')
estimated_reduction_percent: u32Estimated reduction in payload size (percentage 0-100).
Implementations§
Source§impl SqlProjectionHint
impl SqlProjectionHint
Sourcepub const fn new(
database: DatabaseType,
projection_template: String,
estimated_reduction_percent: u32,
) -> Self
pub const fn new( database: DatabaseType, projection_template: String, estimated_reduction_percent: u32, ) -> Self
Creates a new SqlProjectionHint.
Trait Implementations§
Source§impl Clone for SqlProjectionHint
impl Clone for SqlProjectionHint
Source§fn clone(&self) -> SqlProjectionHint
fn clone(&self) -> SqlProjectionHint
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SqlProjectionHint
impl Debug for SqlProjectionHint
Source§impl<'de> Deserialize<'de> for SqlProjectionHint
impl<'de> Deserialize<'de> for SqlProjectionHint
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for SqlProjectionHint
impl PartialEq for SqlProjectionHint
Source§fn eq(&self, other: &SqlProjectionHint) -> bool
fn eq(&self, other: &SqlProjectionHint) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for SqlProjectionHint
impl Serialize for SqlProjectionHint
impl Eq for SqlProjectionHint
impl StructuralPartialEq for SqlProjectionHint
Auto Trait Implementations§
impl Freeze for SqlProjectionHint
impl RefUnwindSafe for SqlProjectionHint
impl Send for SqlProjectionHint
impl Sync for SqlProjectionHint
impl Unpin for SqlProjectionHint
impl UnsafeUnpin for SqlProjectionHint
impl UnwindSafe for SqlProjectionHint
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.