trailsjs / trailpack-waterline

:package: Waterline.js Trailpack
MIT License
8 stars 9 forks source link

How to make waterline-rethinkdb as an official adapter. #80

Closed gutenye closed 7 years ago

gutenye commented 8 years ago

Hi, all

I'm the author of waterline-rethinkdb, I've been using it for months and want to make it as an official adapter, what steps are needed?

I first created sails-rethinkdb for sails, as the reasons we know, I switched to trails and want to make a contribute to trails community.

scott-wyatt commented 8 years ago

Awesome!!! For the waterline trailpack, waterline adapters get loaded here so I'd imagine that you would establish a rethink adapter there. I've also been working on a js-data ORM that could support rethink, and works with waterline style schema. Hope this helps!

jaumard commented 8 years ago

Hi @gutenye ! Normally all waterline adapters has to work with trailpack-waterline so I think you can use your waterline-rethinkdb directly by putting it under the config/database.js file. You have an example here where I use the sails-mongo adapter with Trails https://github.com/jaumard/trails-example-express/blob/master/config/database.js#L32

gutenye commented 8 years ago

@scott-wyatt @jaumard

Thanks for your helping, I've made it working with trails. :tada: I want to put this library into https://github.com/waterlinejs as an official adapter. 1) for new users, they don't have to search a lot to find it. 2) for the community, no need to speed time to create a new one.

jaumard commented 8 years ago

Don't think you can put it as an official adapter because that will means that the waterline team will be officially maintainers of this repo... But you can open an issue on waterline repo to ask the team about this, maybe they'll be agree.

I think the best things to do is a PR to waterline repo and add your adapter into this list but keep it on your github https://github.com/waterlinejs/waterline#community-adapters you can see there a lot of adapters and they're not on the official github.

Copy @tjwebb

gutenye commented 8 years ago

After put it as an official adapter, I can still be a maintainer of it. All waterline adapter are essential part of waterline ecosystem, put them in one place is good for maintenance and development, e.g. coding style, code quality.

I've seen waterline team has been rewriting some adapters in es6, e.g. postgresql-adapter, sqlite3-adapter. I can adapt my repo to fit the missing part.

fernandoans commented 7 years ago

gutenye, exists one error in your adapter with create 2 tables in RethinkDB, example: User / user. For resolve this, in class connection.js I blocked:

this.db.tableCreate(name)...

gutenye commented 7 years ago

@fernandoans PR is welcome.

It has been not be active for more than a year, close for now.

fernandoans commented 7 years ago

In your sails-rethinkdb in file "query.js" a line 63 causes error, the variable/object 'pd' is not defined.

And if you change line 126: case "contains": return row(field).match(value) solve problem with contains

fernandoans commented 7 years ago

Gift for you :)

"query.js" in line 126:

    case "contains": return row(field).match("(?i)^" + value + "$")
    case "startsWith": return row(field).match("(?i)^" + value)
    case "endsWith": return row(field).match("(?i)" + value + "$")
    case "like": return row(field).match("(?i)" + value.replace('%','.'))

Explanation: (?i) case-insensitive, match uses . in replace % and $ final word