@FunctionalInterface public interface DeleteDSLCompleter extends Function<DeleteDSL<DeleteModel>,Buildable<DeleteModel>>
This function is intended to be used in conjunction with a utility method like
MyBatis3Utils.deleteFrom(ToIntFunction, SqlTable, DeleteDSLCompleter)
For example, you can create mapper interface methods like this:
@DeleteProvider(type=SqlProviderAdapter.class, method="delete") int delete(DeleteStatementProvider deleteStatement); default int delete(DeleteDSLCompleter completer) { return MyBatis3Utils.deleteFrom(this::delete, person, completer); }
And then call the simplified default method like this:
int rows = mapper.delete(c -> c.where(occupation, isNull()));
You can implement a "delete all" with the following code:
int rows = mapper.delete(c -> c);
Or
long rows = mapper.delete(DeleteDSLCompleter.allRows());
Modifier and Type | Method and Description |
---|---|
static DeleteDSLCompleter |
allRows()
Returns a completer that can be used to delete every row in a table.
|
static DeleteDSLCompleter allRows()
Copyright © 2016–2021 MyBatis.org. All rights reserved.