mirror of https://github.com/AMT-Cheif/drift.git
Format, fix typos
This commit is contained in:
parent
e66fb0702c
commit
d984f93c3a
|
@ -5,6 +5,9 @@ import 'package:sally/src/runtime/sql_types.dart';
|
|||
Expression<BoolType> and(Expression<BoolType> a, Expression<BoolType> b) =>
|
||||
AndExpression(a, b);
|
||||
|
||||
Expression<BoolType> or(Expression<BoolType> a, Expression<BoolType> b) =>
|
||||
OrExpression(a, b);
|
||||
|
||||
Expression<BoolType> not(Expression<BoolType> a) => NotExpression(a);
|
||||
|
||||
class AndExpression extends Expression<BoolType> with InfixOperator<BoolType> {
|
||||
|
@ -22,7 +25,7 @@ class OrExpression extends Expression<BoolType> with InfixOperator<BoolType> {
|
|||
Expression<BoolType> left, right;
|
||||
|
||||
@override
|
||||
final String operator = 'AND';
|
||||
final String operator = 'OR';
|
||||
|
||||
OrExpression(this.left, this.right);
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
export 'bools.dart' show and, not;
|
||||
export 'bools.dart' show and, or, not;
|
||||
|
|
|
@ -46,7 +46,7 @@ void main() {
|
|||
['Dash', 12]));
|
||||
});
|
||||
|
||||
test('generates expressions from boolean fields', () {
|
||||
test('generates expressions from boolean columns', () {
|
||||
(db.select(db.users)..where((u) => u.isAwesome)).get();
|
||||
|
||||
verify(executor.runSelect(
|
||||
|
@ -54,12 +54,22 @@ void main() {
|
|||
});
|
||||
});
|
||||
|
||||
|
||||
group('Generates DELETE statements', () {
|
||||
test('without any constraints', () {
|
||||
db.delete(db.users).go();
|
||||
|
||||
verify(executor.runDelete('DELETE FROM users;', argThat(isEmpty)));
|
||||
});
|
||||
|
||||
test('for complex components', () {
|
||||
(db.delete(db.users)
|
||||
..where((u) => or(not(u.isAwesome), u.id.isSmallerThan(100)))
|
||||
..limit(10, offset: 100))
|
||||
.go();
|
||||
|
||||
verify(executor.runDelete(
|
||||
'DELETE FROM users WHERE (NOT (is_awesome = 1)) OR (id < ?) LIMIT 10, 100;',
|
||||
[100]));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -5,8 +5,7 @@ class SallyError {
|
|||
final String message;
|
||||
final Element affectedElement;
|
||||
|
||||
SallyError(
|
||||
{this.critical = false, this.message, this.affectedElement});
|
||||
SallyError({this.critical = false, this.message, this.affectedElement});
|
||||
}
|
||||
|
||||
class ErrorStore {
|
||||
|
|
Loading…
Reference in New Issue