rethinkdb

Version, currently master branch1 version
  • master branchlatestJan 4, 2018

github.com/cubos/rethinkdb.cr

RethinkDB Driver for Crystal

34 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  rethinkdb:
    github: cubos/rethinkdb.cr
    branch: master

master is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
no constraint declared
License
MIT
Author
Guilherme Bernal <dev@lbguilherme.com>

Dependencies

This version declares no dependencies.

Documentation

Read the API documentation

Generated from the source of the current release. The first visit to a release that has never been documented starts its build.

README

[![Build Status](https://travis-ci.org/CubosTecnologia/rethinkdb.cr.svg?branch=master)](https://travis-ci.org/CubosTecnologia/rethinkdb.cr)

# rethinkdb.cr

This is a [RethinkDB](http://rethinkdb.com/) Driver for the [Crystal Language](http://crystal-lang.org/).

### WARNING: This library is not ready, a LOT of functions are not implemented yet.

## Installation

Add this to your application's `shard.yml`:

```yaml
dependencies:
  rethinkdb:
    github: CubosTecnologia/rethinkdb.cr
```

## Usage

This library is meant to be compactible with RethinkDB's Ruby API. Thus, all [official documentation](http://rethinkdb.com/api/ruby/) should be valid here. If you find something that behaves differently, please [open an issue](https://github.com/CubosTecnologia/rethinkdb.cr/issues/new).

```crystal
require "rethinkdb"
include RethinkDB::Shortcuts

# Let’s connect and create a table:

conn = r.connect(host: "localhost")
r.db("test").table_create("tv_shows").run(conn)

# Now, let’s insert some JSON documents into the table:

r.table("tv_shows").insert([
  {name: "Star Trek TNG", episodes: 178},
  {name: "Battlestar Galactica", episodes: 75}
]).run(conn)

# We’ve just inserted two rows into the tv_shows table. Let’s verify the number of rows inserted:

pp r.table("tv_shows").count().run(conn)

# Finally, let’s do a slightly more sophisticated query. Let’s find all shows with more than 100 episodes.

p r.table("tv_shows").filter {|show| show["episodes"] > 100 }.run(conn).to_a

# As a result, we of course get the best science fiction show in existence.
```

## Contributing

1. Fork it ( https://github.com/CubosTecnologia/rethinkdb.cr/fork )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request

## Contributors

- **[Cubos Tecnologia](https://cubos.io/)**
- [lbguilherme](https://github.com/lbguilherme) - maintainer