pub struct Relationship {
pub parent_entity: String,
pub child_entity: String,
pub count_field: Option<String>,
pub foreign_key_field: Option<String>,
pub relationship_path: Option<String>,
pub method: String,
}Expand description
Represents a relationship between two entities
Fields§
§parent_entity: StringParent entity name (e.g., “apiary”)
child_entity: StringChild entity name (e.g., “hive”)
count_field: Option<String>Field in parent that indicates count (e.g., “hive_count”)
foreign_key_field: Option<String>Field in child that references parent (e.g., “apiary_id”)
relationship_path: Option<String>API path for the relationship (e.g., “/api/apiaries/{id}/hives”)
method: StringHTTP method for the relationship endpoint
Implementations§
Source§impl Relationship
impl Relationship
Sourcepub fn new(parent_entity: String, child_entity: String) -> Relationship
pub fn new(parent_entity: String, child_entity: String) -> Relationship
Create a new relationship
Sourcepub fn with_count_field(self, field: String) -> Relationship
pub fn with_count_field(self, field: String) -> Relationship
Set the count field
Sourcepub fn with_foreign_key_field(self, field: String) -> Relationship
pub fn with_foreign_key_field(self, field: String) -> Relationship
Set the foreign key field
Sourcepub fn with_path(self, path: String) -> Relationship
pub fn with_path(self, path: String) -> Relationship
Set the relationship path
Trait Implementations§
Source§impl Clone for Relationship
impl Clone for Relationship
Source§fn clone(&self) -> Relationship
fn clone(&self) -> Relationship
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§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 Relationship
impl RefUnwindSafe for Relationship
impl Send for Relationship
impl Sync for Relationship
impl Unpin for Relationship
impl UnsafeUnpin for Relationship
impl UnwindSafe for Relationship
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more