Struct query_structure::prelude::SelectionResult
source · pub struct SelectionResult {
pub pairs: Vec<(SelectedField, PrismaValue)>,
}
Expand description
Represents a set of results.
Fields§
§pairs: Vec<(SelectedField, PrismaValue)>
Implementations§
source§impl SelectionResult
impl SelectionResult
pub fn new<T>(pairs: Vec<(T, PrismaValue)>) -> Selfwhere T: Into<SelectedField>,
pub fn add<T>(&mut self, pair: (T, PrismaValue))where T: Into<SelectedField>,
pub fn get(&self, selection: &SelectedField) -> Option<&PrismaValue>
pub fn values(&self) -> impl Iterator<Item = PrismaValue> + '_
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn db_names(&self) -> impl Iterator<Item = Cow<'_, str>> + '_
sourcepub fn split_into(
self,
field_selections: &[FieldSelection]
) -> Vec<SelectionResult>
pub fn split_into( self, field_selections: &[FieldSelection] ) -> Vec<SelectionResult>
Consumes this SelectionResult
and splits it into a set of SelectionResult
s based on the passed
FieldSelection
s. Assumes that the transformation can be done.
sourcepub fn as_scalar_fields(&self) -> Option<Vec<ScalarFieldRef>>
pub fn as_scalar_fields(&self) -> Option<Vec<ScalarFieldRef>>
Checks if self
only contains scalar field selections and if so, returns them all in a list.
If any other selection is contained, returns None
.
sourcepub fn coerce_values(self) -> Result<Self>
pub fn coerce_values(self) -> Result<Self>
Coerces contained values to best fit their type.
- Scalar fields coerce values based on the TypeIdentifier.
- Composite fields must be objects and contained fields must also follow the type coherence.
Trait Implementations§
source§impl Clone for SelectionResult
impl Clone for SelectionResult
source§fn clone(&self) -> SelectionResult
fn clone(&self) -> SelectionResult
Returns a copy 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 moresource§impl Debug for SelectionResult
impl Debug for SelectionResult
source§impl Default for SelectionResult
impl Default for SelectionResult
source§fn default() -> SelectionResult
fn default() -> SelectionResult
Returns the “default value” for a type. Read more
source§impl From<&FieldSelection> for SelectionResult
impl From<&FieldSelection> for SelectionResult
source§fn from(fs: &FieldSelection) -> Self
fn from(fs: &FieldSelection) -> Self
Converts to this type from the input type.
source§impl From<&SelectionResult> for FieldSelection
impl From<&SelectionResult> for FieldSelection
source§fn from(p: &SelectionResult) -> Self
fn from(p: &SelectionResult) -> Self
Converts to this type from the input type.
source§impl<T> From<(T, PrismaValue)> for SelectionResultwhere
T: Into<SelectedField>,
impl<T> From<(T, PrismaValue)> for SelectionResultwhere T: Into<SelectedField>,
source§fn from((x, value): (T, PrismaValue)) -> Self
fn from((x, value): (T, PrismaValue)) -> Self
Converts to this type from the input type.
source§impl From<SelectionResult> for Record
impl From<SelectionResult> for Record
source§fn from(selection_result: SelectionResult) -> Self
fn from(selection_result: SelectionResult) -> Self
Converts to this type from the input type.
source§impl<T> From<Vec<(T, PrismaValue)>> for SelectionResultwhere
T: Into<SelectedField>,
impl<T> From<Vec<(T, PrismaValue)>> for SelectionResultwhere T: Into<SelectedField>,
source§fn from(tuples: Vec<(T, PrismaValue)>) -> Self
fn from(tuples: Vec<(T, PrismaValue)>) -> Self
Converts to this type from the input type.
source§impl Hash for SelectionResult
impl Hash for SelectionResult
source§impl IntoFilter for SelectionResult
impl IntoFilter for SelectionResult
source§impl IntoIterator for SelectionResult
impl IntoIterator for SelectionResult
§type Item = (SelectedField, PrismaValue)
type Item = (SelectedField, PrismaValue)
The type of the elements being iterated over.
§type IntoIter = IntoIter<<SelectionResult as IntoIterator>::Item>
type IntoIter = IntoIter<<SelectionResult as IntoIterator>::Item>
Which kind of iterator are we turning this into?
source§impl PartialEq for SelectionResult
impl PartialEq for SelectionResult
source§fn eq(&self, other: &SelectionResult) -> bool
fn eq(&self, other: &SelectionResult) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl TryFrom<SelectionResult> for PrismaValue
impl TryFrom<SelectionResult> for PrismaValue
§type Error = DomainError
type Error = DomainError
The type returned in the event of a conversion error.
source§fn try_from(return_values: SelectionResult) -> Result<Self>
fn try_from(return_values: SelectionResult) -> Result<Self>
Performs the conversion.
impl Eq for SelectionResult
impl StructuralEq for SelectionResult
impl StructuralPartialEq for SelectionResult
Auto Trait Implementations§
impl !RefUnwindSafe for SelectionResult
impl Send for SelectionResult
impl Sync for SelectionResult
impl Unpin for SelectionResult
impl !UnwindSafe for SelectionResult
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> CallHasher for Twhere
T: Hash + ?Sized,
impl<T> CallHasher for Twhere T: Hash + ?Sized,
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.