brianloveswords / streamsql

A streaming, backend agnostic SQL ORM heavily inspired by levelup
MIT License
67 stars 7 forks source link

Implement `includeTotal` option for `get`. #22

Closed brianloveswords closed 10 years ago

brianloveswords commented 10 years ago

This came up in a discussion on mozilla/badgekit-api#113 and it seemed like a generically useful thing to provide.

cc @andrewhayward, @christensenep

brianloveswords commented 10 years ago

Can't wait for TravisCI to arbitrarily fail this (tests pass locally)

ghost commented 10 years ago

Oh, nice! Happytimes.

brianloveswords commented 10 years ago

One thing to note (which is noted in the updated docs) – when using includeTotal an object, instead of an array, will be passed back, e.g.

{ total: 39201, rows: [ {id: 1}, {id: 2} ] }

instead of just

[ {id: 1}, {id: 2} ]
brianloveswords commented 10 years ago

Fixed the where issue, let me know if you see anything else stupid.

andrewhayward commented 10 years ago

We don't do GROUP BYs, so not really an issue, but worth remembering this should that ever get implemented.

brianloveswords commented 10 years ago

@andrewhayward Indeed! Does this look ready to go otherwise?

andrewhayward commented 10 years ago

@brianloveswords - mentally, yes... haven't had a chance to run through the code outside of my brain.

brianloveswords commented 10 years ago

GOOD ENOUGH FOR ME! Tests pass and @christensenep tested it with real world code in mozilla/badgekit-api#113.

brianloveswords commented 10 years ago

v0.8.3 published. (0.8.2 is identical to 0.8.1 because I messed up -_-).