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 2439c83
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.start) opts.minVersion = options.start
if (options.until) opts.maxVersion = options.until
return ts(db.versionStream(key, opts).pipe(toTimestream()))
}
db.timeStream = db.ts

return db
}
}

0 comments on commit 2439c83

Please sign in to comment.