Fix order by

This commit is contained in:
Tobe O 2019-04-02 19:30:42 -04:00
parent a5ba325583
commit ee7a6d5f04
4 changed files with 11 additions and 2 deletions

View file

@ -1,3 +1,6 @@
# 2.0.0-dev.24
* Fix a bug that caused syntax errors on `ORDER BY`.
# 2.0.0-dev.23
* Add `@ManyToMany` annotation, which builds many-to-many relations.

View file

@ -344,7 +344,7 @@ abstract class Query<T, Where extends QueryWhere> extends QueryBase<T> {
if (_limit != null) b.write(' LIMIT $_limit');
if (_offset != null) b.write(' OFFSET $_offset');
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();
}

View file

@ -1,5 +1,5 @@
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.
author: Tobe O <thosakwe@gmail.com>
homepage: https://github.com/angel-dart/orm

View file

@ -110,6 +110,12 @@ main() {
expect(author.id, jkRowling.id);
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', () {