pub trait WriteOperations {
    // Required methods
    fn create_record<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        args: WriteArgs,
        selected_fields: FieldSelection,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn create_records<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        args: Vec<WriteArgs>,
        skip_duplicates: bool,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_records<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        record_filter: RecordFilter,
        args: WriteArgs,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn update_record<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        record_filter: RecordFilter,
        args: WriteArgs,
        selected_fields: Option<FieldSelection>,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<Option<SingleRecord>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn native_upsert_record<'life0, 'async_trait>(
        &'life0 mut self,
        upsert: NativeUpsert,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete_records<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        record_filter: RecordFilter,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn delete_record<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: &'life1 Model,
        record_filter: RecordFilter,
        selected_fields: FieldSelection,
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn m2m_connect<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        field: &'life1 RelationFieldRef,
        parent_id: &'life2 SelectionResult,
        child_ids: &'life3 [SelectionResult],
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn m2m_disconnect<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 mut self,
        field: &'life1 RelationFieldRef,
        parent_id: &'life2 SelectionResult,
        child_ids: &'life3 [SelectionResult],
        trace_id: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn execute_raw<'life0, 'async_trait>(
        &'life0 mut self,
        inputs: HashMap<String, PrismaValue>
    ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn query_raw<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        model: Option<&'life1 Model>,
        inputs: HashMap<String, PrismaValue>,
        query_type: Option<String>
    ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
}

Required Methods§

source

fn create_record<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, args: WriteArgs, selected_fields: FieldSelection, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Insert a single record to the database.

source

fn create_records<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, args: Vec<WriteArgs>, skip_duplicates: bool, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Inserts many records at once into the database.

source

fn update_records<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, record_filter: RecordFilter, args: WriteArgs, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update records in the Model with the given WriteArgs filtered by the Filter.

source

fn update_record<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, record_filter: RecordFilter, args: WriteArgs, selected_fields: Option<FieldSelection>, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<Option<SingleRecord>>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Update record in the Model with the given WriteArgs filtered by the Filter.

source

fn native_upsert_record<'life0, 'async_trait>( &'life0 mut self, upsert: NativeUpsert, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Native upsert Use the connectors native upsert to upsert the Model

source

fn delete_records<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, record_filter: RecordFilter, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete records in the Model with the given Filter.

source

fn delete_record<'life0, 'life1, 'async_trait>( &'life0 mut self, model: &'life1 Model, record_filter: RecordFilter, selected_fields: FieldSelection, trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<SingleRecord>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Delete single record in the Model with the given Filter. Return selected fields of the deleted record, if the connector supports it. If the connector does not support it, error is returned.

source

fn m2m_connect<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, field: &'life1 RelationFieldRef, parent_id: &'life2 SelectionResult, child_ids: &'life3 [SelectionResult], trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Connect the children to the parent (m2m relation only).

source

fn m2m_disconnect<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 mut self, field: &'life1 RelationFieldRef, parent_id: &'life2 SelectionResult, child_ids: &'life3 [SelectionResult], trace_id: Option<String> ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Disconnect the children from the parent (m2m relation only).

source

fn execute_raw<'life0, 'async_trait>( &'life0 mut self, inputs: HashMap<String, PrismaValue> ) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait,

Execute the raw query in the database as-is. The parsing of the query arguments is deferred to the connectors.

Returns the number of rows affected.

source

fn query_raw<'life0, 'life1, 'async_trait>( &'life0 mut self, model: Option<&'life1 Model>, inputs: HashMap<String, PrismaValue>, query_type: Option<String> ) -> Pin<Box<dyn Future<Output = Result<Value>> + Send + 'async_trait>>where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Execute the raw query in the database as-is. The parsing of the query arguments is deferred to the connectors.

Returns resulting rows as JSON.

Implementors§