Skip to content

Commit

Permalink
Add support for start and end ranges at query time
Browse files Browse the repository at this point in the history
  • Loading branch information
aredridel committed Nov 8, 2015
1 parent a1d0143 commit 96725b3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions timestreamdb.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,14 @@ function TimestreamDB(instance, options) {

var db = Version(instance, options)

db.ts = function (key) {
return ts(db.versionStream(key, {reverse: true}).pipe(toTimestream()))
db.ts = function (key, options) {
var opts = {reverse: true}

if (options.from) opts.minVersion = options.from
if (options.to) opts.maxVersion = options.to
return ts(db.versionStream(key, opts).pipe(toTimestream()))
}
db.timeStream = db.ts

return db
}
}

0 comments on commit 96725b3

Please sign in to comment.