Enum query_structure::SelectedField
source · pub enum SelectedField {
Scalar(ScalarFieldRef),
Composite(CompositeSelection),
Relation(RelationSelection),
Virtual(VirtualSelection),
}
Expand description
A selected field. Can be contained on a model or composite type.
Variants§
Scalar(ScalarFieldRef)
Composite(CompositeSelection)
Relation(RelationSelection)
Virtual(VirtualSelection)
Implementations§
source§impl SelectedField
impl SelectedField
pub fn prisma_name(&self) -> Cow<'_, str>
sourcepub fn db_name(&self) -> Cow<'_, str>
pub fn db_name(&self) -> Cow<'_, str>
Returns the name of the field in the database (if applicable) or other kind of name that is used in the queries for this field. For virtual fields, this returns the alias used in the queries that do not group them into objects.
sourcepub fn db_name_grouping_virtuals(&self) -> Cow<'_, str>
pub fn db_name_grouping_virtuals(&self) -> Cow<'_, str>
Returns the name of the field in the database (if applicable) or other kind of name that is
used in the queries for this field. For virtual fields that are wrapped inside an object in
Prisma queries, this returns the name of the surrounding object and not the field itself,
so this method can return identical values for multiple fields in the FieldSelection
.
This is used in queries with relation JOINs which use JSON objects to represent both
relations and relation aggregations. For those queries, the result of this method
corresponds to the top-level name of the value which is a JSON object that contains this
field inside.
sourcepub fn type_identifier_with_arity(&self) -> Option<(TypeIdentifier, FieldArity)>
pub fn type_identifier_with_arity(&self) -> Option<(TypeIdentifier, FieldArity)>
Returns the type identifier and arity of this field, unless it is a composite field, in
which case None
is returned.
sourcepub fn type_identifier_with_arity_grouping_virtuals(
&self
) -> Option<(TypeIdentifier, FieldArity)>
pub fn type_identifier_with_arity_grouping_virtuals( &self ) -> Option<(TypeIdentifier, FieldArity)>
Returns the type identifier and arity of this field, unless it is a composite field, in
which case None
is returned.
In the case of virtual fields that are wrapped into objects in Prisma queries (specifically, relation aggregations), the returned information refers not to the current field itself but to the whole object that contains this field. This is used by the queries with relation JOINs because they use JSON objects to reprsent both relations and relation aggregations, so individual virtual fields that correspond to those relation aggregations don’t exist as separate values in the result of the query.
pub fn as_composite(&self) -> Option<&CompositeSelection>
pub fn as_virtual(&self) -> Option<&VirtualSelection>
pub fn container(&self) -> ParentContainer
Trait Implementations§
source§impl Clone for SelectedField
impl Clone for SelectedField
source§fn clone(&self) -> SelectedField
fn clone(&self) -> SelectedField
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SelectedField
impl Debug for SelectedField
source§impl Display for SelectedField
impl Display for SelectedField
source§impl From<Zipper<ScalarFieldId>> for SelectedField
impl From<Zipper<ScalarFieldId>> for SelectedField
source§fn from(f: ScalarFieldRef) -> Self
fn from(f: ScalarFieldRef) -> Self
source§impl Hash for SelectedField
impl Hash for SelectedField
source§impl PartialEq for SelectedField
impl PartialEq for SelectedField
source§fn eq(&self, other: &SelectedField) -> bool
fn eq(&self, other: &SelectedField) -> bool
self
and other
values to be equal, and is used
by ==
.impl Eq for SelectedField
impl StructuralEq for SelectedField
impl StructuralPartialEq for SelectedField
Auto Trait Implementations§
impl !RefUnwindSafe for SelectedField
impl Send for SelectedField
impl Sync for SelectedField
impl Unpin for SelectedField
impl !UnwindSafe for SelectedField
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
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
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
key
and return true
if they are equal.