Git Product home page Git Product logo

sails-rethinkdb's Introduction

sails-rethinkdb, a RethinkDB Adapter for Sails.

Homepage | Documentation | Issue Tracker | MIT License | by Guten | Gratipay | Bountysource

Contributions are welcome, the code is well structured and easy to understand.

Install

$ npm install gutenye/sails-rethinkdb#master

USAGE

# edit config/connections.js

  rethinkdb: {
    adapter: 'sails-rethinkdb',
    host: 'localhost',
    db: 'test'
  }

# edit config/models.js

  connection: 'rethinkdb'

Connections Options Reference

native() method

User.native((err, table) => {
  var {conn, r} = table
  table.filter({id: 1}).count().run(conn, (err, result) => {
    ..
  })
})

Relationships

one-to-many: r.table("posts").indexCreate("user") many-to-many: r.table("tags_users__users_tags").indexCreate("users_tags") r.table("tags_users__users_tags").indexCreate("tags_users")

Assess rethinkdb

sails.r
sails.conn

# Some times you need create index manulaly

const {r, conn} = sails
r.table("tags_users__users_tags").indexCreate("users_tags").run(conn, (err, result) => {})

Roadmap

Sails Query Language 80%
create COMPLETED
update COMPLETED
destroy COMPLETED
count COMPLETED
native COMPLETED
join COMPLETED
stream NOT

Query Language Different from Official

  • contains is for array
{tags: {"contains": [1, 2]}} means tags.includes(1) and tags.includes(2)
  • limit, skip support string, and limit support -1
{limit: 30}
{limit: "30"}
{limit: -1}     -1 means all records

Development

Contributing

  • Submit any bugs/features/ideas to github issue tracker.

Thanks to all contributors.

Copyright

The MIT License (MIT)

Copyright (c) 2015-2016 Guten Ye

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

sails-rethinkdb's People

Contributors

gutenye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

sails-rethinkdb's Issues

CRUD production

Hi, thanks for this great work!!

Is the CRUD part production ready?

Best norbu

waterline

I am trying to use this adapter with waterline, but without using sails.

Unfortunately this crashes out in

              sails-rethinkdb/lib/connection.js:17:5

              .... with the following error ReferenceError: sails is not defined.

because the global sails object is missing.

Would it be possible to adapt this to being a "pure" waterline adapter?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.