pub struct FieldMapping {
pub source: String,
pub output: String,
pub nested_typename: Option<String>,
pub nested_fields: Option<Vec<FieldMapping>>,
}Expand description
Field mapping for projection with alias support.
Fields§
§source: StringJSONB key name (source).
output: StringOutput key name (alias if different from source).
nested_typename: Option<String>For nested object fields, the typename to add.
This enables __typename to be added recursively to nested objects.
nested_fields: Option<Vec<FieldMapping>>Nested field mappings (for related objects).
Implementations§
Source§impl FieldMapping
impl FieldMapping
Sourcepub fn aliased(source: impl Into<String>, alias: impl Into<String>) -> Self
pub fn aliased(source: impl Into<String>, alias: impl Into<String>) -> Self
Create a field mapping with an alias.
Sourcepub fn nested_object(
name: impl Into<String>,
typename: impl Into<String>,
fields: Vec<FieldMapping>,
) -> Self
pub fn nested_object( name: impl Into<String>, typename: impl Into<String>, fields: Vec<FieldMapping>, ) -> Self
Sourcepub fn nested_object_aliased(
source: impl Into<String>,
alias: impl Into<String>,
typename: impl Into<String>,
fields: Vec<FieldMapping>,
) -> Self
pub fn nested_object_aliased( source: impl Into<String>, alias: impl Into<String>, typename: impl Into<String>, fields: Vec<FieldMapping>, ) -> Self
Create an aliased nested object field.
Sourcepub fn with_nested_typename(self, typename: impl Into<String>) -> Self
pub fn with_nested_typename(self, typename: impl Into<String>) -> Self
Set the typename for a nested object field.
Sourcepub fn with_nested_fields(self, fields: Vec<FieldMapping>) -> Self
pub fn with_nested_fields(self, fields: Vec<FieldMapping>) -> Self
Set nested field mappings.
Trait Implementations§
Source§impl Clone for FieldMapping
impl Clone for FieldMapping
Source§fn clone(&self) -> FieldMapping
fn clone(&self) -> FieldMapping
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for FieldMapping
impl RefUnwindSafe for FieldMapping
impl Send for FieldMapping
impl Sync for FieldMapping
impl Unpin for FieldMapping
impl UnsafeUnpin for FieldMapping
impl UnwindSafe for FieldMapping
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