Skip to main content

HandleUpdate

Trait HandleUpdate 

Source
pub trait HandleUpdate<L, U, DB, Ctx> {
    // Required method
    fn handle_update(
        selection: Option<&[Selection<'_, WundergraphScalarValue>]>,
        executor: &Executor<'_, Ctx, WundergraphScalarValue>,
        update: &U,
    ) -> ExecutionResult<WundergraphScalarValue>;
}
Expand description

A trait to handle update mutations for database entities

Type parameters:

  • Self: database table type for diesel
  • U: data to update into the table. This type should contain information which entry should be updated (by containing the primary key) and the data that should be actually updated
  • DB: Backend type from diesel, so one of Pg or Sqlite
  • Ctx: The used wundergraph context type

A default implementation is provided for all types implementing diesel::AsChangeset

Required Methods§

Source

fn handle_update( selection: Option<&[Selection<'_, WundergraphScalarValue>]>, executor: &Executor<'_, Ctx, WundergraphScalarValue>, update: &U, ) -> ExecutionResult<WundergraphScalarValue>

Actual function called to insert a database entity

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<L, U, DB, Ctx, T> HandleUpdate<L, U, DB, Ctx> for T
where T: Table + HasTable<Table = T> + FindDsl<<&'static U as Identifiable>::Id> + 'static + BoxedDsl<'static, DB, Output = BoxedSelectStatement<'static, SqlTypeOf<<T as Table>::AllColumns>, T, DB>>, DB: Backend + ApplyOffset + 'static + HasSqlType<SqlTypeOfPlaceholder<L::FieldList, DB, L::PrimaryKeyIndex, T, Ctx>>, DB::QueryBuilder: Default, T::FromClause: QueryFragment<DB>, L: LoadingHandler<DB, Ctx, Table = T>, L::Columns: BuildOrder<T, DB> + BuildSelect<T, DB, SqlTypeOfPlaceholder<L::FieldList, DB, L::PrimaryKeyIndex, T, Ctx>>, Ctx: WundergraphContext + QueryModifier<L, DB>, Ctx::Connection: Connection<Backend = DB>, L::FieldList: WundergraphFieldList<DB, L::PrimaryKeyIndex, T, Ctx>, <L::Filter as BuildFilter<DB>>::Ret: AppearsOnTable<T>, U: 'static, &'static U: AsChangeset<Target = T> + Identifiable + HasTable<Table = T>, Find<T, <&'static U as Identifiable>::Id>: IntoUpdateTarget<Table = T>, <Find<T, <&'static U as Identifiable>::Id> as IntoUpdateTarget>::WhereClause: QueryFragment<DB>, <&'static U as AsChangeset>::Changeset: QueryFragment<DB>, T::PrimaryKey: EqAll<<&'static U as Identifiable>::Id> + Default, <T::PrimaryKey as EqAll<<&'static U as Identifiable>::Id>>::Output: AppearsOnTable<T> + NonAggregate + QueryFragment<DB>,