mirror of https://github.com/AMT-Cheif/drift.git
insertable bug
This commit is contained in:
parent
3cd64901d6
commit
6325a58b56
|
@ -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<int> write(Insertable<DT> Function(CU o) f) =>
|
||||
Future<int> 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<int> create(Insertable<D> Function(CI o) f,
|
||||
Future<int> create(D Function(CI o) f,
|
||||
{InsertMode? mode, UpsertClause<T, D>? 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<D> createReturning(Insertable<D> Function(CI o) f,
|
||||
Future<D> createReturning(D Function(CI o) f,
|
||||
{InsertMode? mode, UpsertClause<T, D>? 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<D?> createReturningOrNull(Insertable<D> Function(CI o) f,
|
||||
Future<D?> createReturningOrNull(D Function(CI o) f,
|
||||
{InsertMode? mode, UpsertClause<T, D>? 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<void> bulkCreate(Iterable<Insertable<D>> Function(CI o) f,
|
||||
Future<void> bulkCreate(Iterable<D> Function(CI o) f,
|
||||
{InsertMode? mode, UpsertClause<T, D>? 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<bool> replace(Insertable<D> entity) {
|
||||
Future<bool> replace(D entity) {
|
||||
return $state.db.update($state._tableAsTableInfo).replace(entity);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue