Jaguar-dart / jaguar_orm

Source-generated ORM with relations (one-to-one, one-to-many, many-to-many), preloading, cascading, polymorphic relations, etc
https://jaguar-dart.github.io
BSD 3-Clause "New" or "Revised" License
217 stars 52 forks source link

Having a count method generated #115

Open jaumard opened 5 years ago

jaumard commented 5 years ago

Would be nice to have a count method generated to be able to count number of items from a where query a get a integer.

Because for now all we can do (a I know) is:

final items = await bean.findMany(bean.finder);
return items.length;

But it not optimized as you'll map all the objects just to get a count :/

Maybe there a better way @tejainece ?

tejainece commented 5 years ago

@jaumard This is cool.

Jaguar_query already has count clause.

PR is welcome.