Fix order by
This commit is contained in:
parent
a5ba325583
commit
ee7a6d5f04
4 changed files with 11 additions and 2 deletions
|
@ -1,3 +1,6 @@
|
||||||
|
# 2.0.0-dev.24
|
||||||
|
* Fix a bug that caused syntax errors on `ORDER BY`.
|
||||||
|
|
||||||
# 2.0.0-dev.23
|
# 2.0.0-dev.23
|
||||||
* Add `@ManyToMany` annotation, which builds many-to-many relations.
|
* Add `@ManyToMany` annotation, which builds many-to-many relations.
|
||||||
|
|
||||||
|
|
|
@ -344,7 +344,7 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
|
||||||
if (_limit != null) b.write(' LIMIT $_limit');
|
if (_limit != null) b.write(' LIMIT $_limit');
|
||||||
if (_offset != null) b.write(' OFFSET $_offset');
|
if (_offset != null) b.write(' OFFSET $_offset');
|
||||||
if (_groupBy != null) b.write(' GROUP BY $_groupBy');
|
if (_groupBy != null) b.write(' GROUP BY $_groupBy');
|
||||||
for (var item in _orderBy) b.write(' ${item.compile()}');
|
for (var item in _orderBy) b.write(' ORDER BY ${item.compile()}');
|
||||||
return b.toString();
|
return b.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
name: angel_orm
|
name: angel_orm
|
||||||
version: 2.0.0-dev.23
|
version: 2.0.0-dev.24
|
||||||
description: Runtime support for Angel's ORM. Includes base classes for queries.
|
description: Runtime support for Angel's ORM. Includes base classes for queries.
|
||||||
author: Tobe O <thosakwe@gmail.com>
|
author: Tobe O <thosakwe@gmail.com>
|
||||||
homepage: https://github.com/angel-dart/orm
|
homepage: https://github.com/angel-dart/orm
|
||||||
|
|
|
@ -110,6 +110,12 @@ main() {
|
||||||
expect(author.id, jkRowling.id);
|
expect(author.id, jkRowling.id);
|
||||||
expect(author.name, jkRowling.name);
|
expect(author.name, jkRowling.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('order by', () async {
|
||||||
|
var query = AuthorQuery()..orderBy(AuthorFields.name, descending: true);
|
||||||
|
var authors = await query.get(executor);
|
||||||
|
expect(authors, [jkRowling, jameson]);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('insert sets relationship', () {
|
test('insert sets relationship', () {
|
||||||
|
|
Loading…
Reference in a new issue