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§

Implementations§

source§

impl SelectedField

source

pub fn prisma_name(&self) -> Cow<'_, str>

source

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.

source

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.

source

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.

source

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.

source

pub fn as_composite(&self) -> Option<&CompositeSelection>

source

pub fn as_virtual(&self) -> Option<&VirtualSelection>

source

pub fn container(&self) -> ParentContainer

source

pub fn is_scalar(&self) -> bool

Returns true if the selected field is [Scalar].

Trait Implementations§

source§

impl Clone for SelectedField

source§

fn clone(&self) -> SelectedField

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for SelectedField

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for SelectedField

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Zipper<ScalarFieldId>> for SelectedField

source§

fn from(f: ScalarFieldRef) -> Self

Converts to this type from the input type.
source§

impl Hash for SelectedField

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for SelectedField

source§

fn eq(&self, other: &SelectedField) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Eq for SelectedField

source§

impl StructuralEq for SelectedField

source§

impl StructuralPartialEq for SelectedField

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CallHasher for Twhere T: Hash + ?Sized,

source§

fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64where H: Hash + ?Sized, B: BuildHasher,

source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

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,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for Twhere T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

source§

fn vzip(self) -> V