[−][src]Struct warpgrapher::engine::config::Relationship
Configuration item for a relationship on a GraphQL type
Examples
let r = Relationship::new( "teams".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None );
Implementations
impl Relationship
[src]
pub fn new(
name: String,
list: bool,
nodes: Vec<String>,
props: Vec<Property>,
endpoints: EndpointsFilter,
resolver: Option<String>
) -> Relationship
[src]
name: String,
list: bool,
nodes: Vec<String>,
props: Vec<Property>,
endpoints: EndpointsFilter,
resolver: Option<String>
) -> Relationship
Creates a new Relationship struct.
Arguments
- a String for the name of the relationship
- a boolean that, if true, indicates that the property is a list, and if false, that the relationship is to a single node
- a list of possible destination node types for the relationship. A single element in the list indicates that this is a single-type relationship, whereas more than one element indicates a multi-type relationship.
- an
EndpointsFilter
struct indicating which of the standard operations (create, read, update, and delete) should be generated for this relationship - an optional string providing the name of a resolver, if the relationship is a dynamic relationship with a custom resolver
Examples
let r = Relationship::new("name".to_string(), false, vec!["User".to_string()], vec![], EndpointsFilter::all(), None);
pub fn endpoints(&self) -> &EndpointsFilter
[src]
Returns the EndpointsFilter
struct that indicates which of the four basic Create, Read,
Update, and Delete (CRUD) operations Warpgrapher should auto-generate for this
relationship.
Examples
let r = Relationship::new("name".to_string(), false, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert_eq!(&EndpointsFilter::all(), r.endpoints());
pub fn list(&self) -> bool
[src]
Returns true if the relationship is a list, indicating a one-to-many (or many-to-many) relationship. Returns false if the node can only have one relationship of this type.
Examples
let r = Relationship::new("name".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert!(r.list());
pub fn name(&self) -> &str
[src]
Returns the name of the relationship
Examples
let r = Relationship::new("RelName".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert_eq!("RelName", r.name());
pub fn nodes(&self) -> Iter<'_, String>
[src]
Returns an iterator over the names of the Warpgrapher Type
definitions that are
possible destination nodes for this relationship.
Examples
let r = Relationship::new("RelName".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert_eq!(1, r.nodes().count()); assert_eq!("User", r.nodes().next().expect("Expected an element"));
pub fn props_as_slice(&self) -> &[Property]
[src]
Returns a slice of Property
references for properties associated with the relationship.
Examples
let r = Relationship::new("RelName".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert_eq!(0, r.props_as_slice().len())
pub fn resolver(&self) -> Option<&String>
[src]
Returns an option for a string containing the name of a custom resolver, if this relationship is resolved by a custom resolver instead of an auto-generated read resolver.
Examples
let r = Relationship::new("RelName".to_string(), true, vec!["User".to_string()], vec![], EndpointsFilter::all(), None); assert!(r.resolver().is_none())
Trait Implementations
impl Clone for Relationship
[src]
fn clone(&self) -> Relationship
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Relationship
[src]
impl<'de> Deserialize<'de> for Relationship
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Eq for Relationship
[src]
impl Hash for Relationship
[src]
fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for Relationship
[src]
fn cmp(&self, other: &Relationship) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl PartialEq<Relationship> for Relationship
[src]
fn eq(&self, other: &Relationship) -> bool
[src]
fn ne(&self, other: &Relationship) -> bool
[src]
impl PartialOrd<Relationship> for Relationship
[src]
fn partial_cmp(&self, other: &Relationship) -> Option<Ordering>
[src]
fn lt(&self, other: &Relationship) -> bool
[src]
fn le(&self, other: &Relationship) -> bool
[src]
fn gt(&self, other: &Relationship) -> bool
[src]
fn ge(&self, other: &Relationship) -> bool
[src]
impl Serialize for Relationship
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Relationship
[src]
impl StructuralPartialEq for Relationship
[src]
Auto Trait Implementations
impl RefUnwindSafe for Relationship
impl Send for Relationship
impl Sync for Relationship
impl Unpin for Relationship
impl UnwindSafe for Relationship
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
pub fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
fn instrument(self, span: Span) -> Instrumented<Self>
[src]
fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,