pub struct SelectSpec {
pub model_name: String,
pub fields: FieldSelection,
pub relations: HashMap<String, SelectSpec>,
}Expand description
Specification for which fields to select from a model.
Fields§
§model_name: StringModel name this selection is for.
fields: FieldSelectionFields to include (empty means all).
relations: HashMap<String, SelectSpec>Relation selections.
Implementations§
Source§impl SelectSpec
impl SelectSpec
Sourcepub fn only(
model_name: impl Into<String>,
fields: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn only( model_name: impl Into<String>, fields: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Select only specific fields.
Sourcepub fn except(
model_name: impl Into<String>,
fields: impl IntoIterator<Item = impl Into<String>>,
) -> Self
pub fn except( model_name: impl Into<String>, fields: impl IntoIterator<Item = impl Into<String>>, ) -> Self
Exclude specific fields.
Sourcepub fn fields(self, names: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn fields(self, names: impl IntoIterator<Item = impl Into<String>>) -> Self
Add multiple fields to the selection.
Sourcepub fn relation(self, name: impl Into<String>, select: SelectSpec) -> Self
pub fn relation(self, name: impl Into<String>, select: SelectSpec) -> Self
Include a relation with its selection.
Sourcepub fn is_field_selected(&self, field: &str) -> bool
pub fn is_field_selected(&self, field: &str) -> bool
Check if a field is selected.
Sourcepub fn selected_fields(&self) -> Option<&HashSet<String>>
pub fn selected_fields(&self) -> Option<&HashSet<String>>
Get the list of selected fields (if explicit).
Sourcepub fn excluded_fields(&self) -> Option<&HashSet<String>>
pub fn excluded_fields(&self) -> Option<&HashSet<String>>
Get the list of excluded fields (if explicit).
Trait Implementations§
Source§impl Clone for SelectSpec
impl Clone for SelectSpec
Source§fn clone(&self) -> SelectSpec
fn clone(&self) -> SelectSpec
Returns a duplicate of the value. Read more
1.0.0§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 SelectSpec
impl RefUnwindSafe for SelectSpec
impl Send for SelectSpec
impl Sync for SelectSpec
impl Unpin for SelectSpec
impl UnwindSafe for SelectSpec
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)