README.md in sequel-xtdb-0.3.0 vs README.md in sequel-xtdb-0.3.2

- old
+ new

@@ -1,9 +1,11 @@ -# Sequel::XTDB +# sequel-xtdb -Adapter to connect to XTDB v2 using Sequel. +[![Gem Version](https://badge.fury.io/rb/sequel-xtdb.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/sequel-xtdb) +Adapter to connect to [XTDB](https://docs.xtdb.com/) v2 using [Sequel](https://sequel.jeremyevans.net/). + ## Installation Install the gem and add to the application's Gemfile by executing: ```bash @@ -32,47 +34,48 @@ => [{:_id=>2, :name=>"Ham", :price=>1200}, {:_id=>1, :name=>"Spam", :price=>1100}] ``` ### time-travel -_these examples use the [activesupport time helpers](https://api.rubyonrails.org/classes/ActiveSupport/Duration.html)_ - ```ruby +def shift_days(n, from: Time.now)= from + (60 * 60 * 24 * n) DB = Sequel.connect("xtdb://localhost:5432/xtdb") # get a dataset (ie query) users = DB[:users] -past, future = 2.days.ago, 2.days.from_now -ds1, ds2 = users.as_of(valid: past), users.as_of(valid: future) +ds1, ds2 = users.as_of(valid: shift_days(-2)), users.as_of(valid: shift_days(2)) # expect empty ds1.all ds1.insert(_id: 1, name: "James") # expect a user -ds1.as_of(valid: 2.days.ago).all +ds1.as_of(valid: shift_days(-1)).all # add to future ds2.insert(_id: 2, name: "Jeremy") # expect only James users.all # expect both James and Jeremy -ds2.as_of(valid: 2.days.from_now).all +ds2.as_of(valid: shift_days(3)).all ``` - ## Status -Very early days :) -Currently it's essentially the postgres-adapter with support for a xtdb-scheme url. +Very early days :) ## Development After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. -You can also run `bin/console [xtdb-url]` for an interactive prompt that will allow you to experiment. The script will pick up on env-var `XTDB_URL`, though the argument takes precedence. +You can also run `bin/console [xtdb-url]` for an interactive prompt that will allow you to experiment. The script will pick up on env-var `XTDB_URL`, though the argument takes precedence. The console-script sets up (query-)logging. + +Speaking of logging: best to start the XTDB docker container with debug-logging: +``` +docker run -it --pull=always -e XTDB_LOGGING_LEVEL=debug -v $PWD/tmp/db:/var/lib/xtdb -p 6543:3000 -p 5432:5432 ghcr.io/xtdb/xtdb:nightly +``` To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing