Moor: How to use OrderingMode.desc?

Created on 18 Dec 2019  路  4Comments  路  Source: simolus3/moor

Future<List<ABC>> getReadings() {
    return (select(readings)
          ..orderBy([(t) => OrderingMode.desc(expression:t.updatedAt)]))
        .get();
  }

Error

The expression doesn't evaluate to a function, so it can't be invoked.

Most helpful comment

At the moment, the correct way to do this would be

[(t) => OrderingTerm(expression: t.updatedAt, mode: OrderingMode.desc)]

I like the idea of having OrderingTerm.desc and OrderingTerm.asc factories though, they could make this feature easier to use.

All 4 comments

At the moment, the correct way to do this would be

[(t) => OrderingTerm(expression: t.updatedAt, mode: OrderingMode.desc)]

I like the idea of having OrderingTerm.desc and OrderingTerm.asc factories though, they could make this feature easier to use.

Kinda weird. I want to display number based on OrderingMode.asc, but I get this:

1,10,11,2,3,4,5,6,7,8,9

Sounds like that number is actually a string. If you post your query and table declaration I can take a look on how to fix that.

I changed String to int, it works now . Thanks.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omidraha picture omidraha  路  3Comments

felixjunghans picture felixjunghans  路  4Comments

cadaniel picture cadaniel  路  4Comments

simolus3 picture simolus3  路  4Comments

stx picture stx  路  3Comments