From 6325a58b56b1c00f3b6bd32913d81cd87c778865 Mon Sep 17 00:00:00 2001 From: Moshe Dicker Date: Wed, 3 Apr 2024 14:26:12 -0400 Subject: [PATCH] insertable bug --- drift/lib/src/runtime/manager/manager.dart | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drift/lib/src/runtime/manager/manager.dart b/drift/lib/src/runtime/manager/manager.dart index c1a15e74..212561e7 100644 --- a/drift/lib/src/runtime/manager/manager.dart +++ b/drift/lib/src/runtime/manager/manager.dart @@ -339,7 +339,7 @@ abstract class BaseTableManager< /// /// See also: [RootTableManager.replace], which does not require [filter] statements and /// supports setting fields back to null. - Future write(Insertable
Function(CU o) f) => + Future write(DT Function(CU o) f) => $state.buildUpdateStatement().write(f($state._getUpdateCompanionBuilder)); } @@ -452,7 +452,7 @@ abstract class RootTableManager< /// /// If the table doesn't have a `rowid`, you can't rely on the return value. /// Still, the future will always complete with an error if the insert fails. - Future create(Insertable Function(CI o) f, + Future create(D Function(CI o) f, {InsertMode? mode, UpsertClause? onConflict}) { return $state.db.into($state._tableAsTableInfo).insert( f($state._getInsertCompanionBuilder), @@ -468,7 +468,7 @@ abstract class RootTableManager< /// exception in that case. Use [createReturningOrNull] when performing an /// insert with an insert mode like [InsertMode.insertOrIgnore] or when using /// a [DoUpdate] with a `where` clause clause. - Future createReturning(Insertable Function(CI o) f, + Future createReturning(D Function(CI o) f, {InsertMode? mode, UpsertClause? onConflict}) { return $state.db.into($state._tableAsTableInfo).insertReturning( f($state._getInsertCompanionBuilder), @@ -481,7 +481,7 @@ abstract class RootTableManager< /// When no row was inserted and no exception was thrown, for instance because /// [InsertMode.insertOrIgnore] was used or because the upsert clause had a /// `where` clause that didn't match, `null` is returned instead. - Future createReturningOrNull(Insertable Function(CI o) f, + Future createReturningOrNull(D Function(CI o) f, {InsertMode? mode, UpsertClause? onConflict}) { return $state.db.into($state._tableAsTableInfo).insertReturningOrNull( f($state._getInsertCompanionBuilder), @@ -501,7 +501,7 @@ abstract class RootTableManager< /// checks. /// [onConflict] can be used to create an upsert clause for engines that /// support it. For details and examples, see [InsertStatement.insert]. - Future bulkCreate(Iterable> Function(CI o) f, + Future bulkCreate(Iterable Function(CI o) f, {InsertMode? mode, UpsertClause? onConflict}) { return $state.db.batch((b) => b.insertAll( $state._tableAsTableInfo, f($state._getInsertCompanionBuilder), @@ -520,7 +520,7 @@ abstract class RootTableManager< /// ignores such fields without changing them in the database. /// /// Returns true if a row was affected by this operation. - Future replace(Insertable entity) { + Future replace(D entity) { return $state.db.update($state._tableAsTableInfo).replace(entity); } }