pub struct DataBuilder { /* private fields */ }Expand description
A flexible data builder for create/update operations.
This builder allows setting fields dynamically and supports nested creates, connects, and all update operations.
Implementations§
Source§impl DataBuilder
impl DataBuilder
Sourcepub fn set(self, field: impl Into<String>, value: impl Into<FieldValue>) -> Self
pub fn set(self, field: impl Into<String>, value: impl Into<FieldValue>) -> Self
Set a field value.
Sourcepub fn set_default(self, field: impl Into<String>) -> Self
pub fn set_default(self, field: impl Into<String>) -> Self
Set a field to its default value.
Sourcepub fn push(
self,
field: impl Into<String>,
value: impl Into<FieldValue>,
) -> Self
pub fn push( self, field: impl Into<String>, value: impl Into<FieldValue>, ) -> Self
Push a value to an array field.
Sourcepub fn connect(
self,
relation: impl Into<String>,
id: impl Into<FieldValue>,
) -> Self
pub fn connect( self, relation: impl Into<String>, id: impl Into<FieldValue>, ) -> Self
Connect to an existing related record by ID.
Sourcepub fn connect_by(
self,
relation: impl Into<String>,
field: impl Into<String>,
value: impl Into<FieldValue>,
) -> Self
pub fn connect_by( self, relation: impl Into<String>, field: impl Into<String>, value: impl Into<FieldValue>, ) -> Self
Connect to an existing related record by a specific field.
Sourcepub fn disconnect(self, relation: impl Into<String>) -> Self
pub fn disconnect(self, relation: impl Into<String>) -> Self
Disconnect from a related record.
Sourcepub fn create_nested(
self,
relation: impl Into<String>,
data: DataBuilder,
) -> Self
pub fn create_nested( self, relation: impl Into<String>, data: DataBuilder, ) -> Self
Create a nested record.
Sourcepub fn into_fields(self) -> HashMap<String, FieldValue>
pub fn into_fields(self) -> HashMap<String, FieldValue>
Get the fields map.
Sourcepub fn get(&self, field: &str) -> Option<&FieldValue>
pub fn get(&self, field: &str) -> Option<&FieldValue>
Get a field value.
Trait Implementations§
Source§impl Clone for DataBuilder
impl Clone for DataBuilder
Source§fn clone(&self) -> DataBuilder
fn clone(&self) -> DataBuilder
Returns a duplicate 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 DataBuilder
impl Debug for DataBuilder
Source§impl Default for DataBuilder
impl Default for DataBuilder
Source§fn default() -> DataBuilder
fn default() -> DataBuilder
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for DataBuilder
impl<'de> Deserialize<'de> for DataBuilder
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl IntoData for DataBuilder
impl IntoData for DataBuilder
Source§fn into_data(self) -> DataBuilder
fn into_data(self) -> DataBuilder
Convert into a DataBuilder.
Auto Trait Implementations§
impl Freeze for DataBuilder
impl RefUnwindSafe for DataBuilder
impl Send for DataBuilder
impl Sync for DataBuilder
impl Unpin for DataBuilder
impl UnsafeUnpin for DataBuilder
impl UnwindSafe for DataBuilder
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