Closed bmac closed 10 years ago
Yes, that should be possible.
You just have to make sure your custom adapter has the same syntax as the other ones, i.e.
// create new user
adapter.save('john', 'john@email.com', 'secret', function(err, user) {});
// find user
adapter.find('name', 'john', function(err, user) {});
// update user
adapter.update(user, function(err, user) {});
// remove user
adapter.remove('john', function(err, res) {});
I will then change index.js#L48 and make the adapter configurable. Maybe add another field to exports.db
in config.js
exports.db = {
url: 'postgres://127.0.0.1:5432/',
name: 'users',
collection: 'my_user_table',
adapter: [adapter name]
};
[adapter name]
would be your custom adapter on npm. Does that work for you?
That should work for me. Thanks.
No worries, thank you for the good idea!
I'll put it in the next release.
Hi @zemirco. Awesome project! This is exactly what I've been looking for.
I was wondering if it would be possible to support a the ability to specify a custom adapter module? It looks like the getDatabase function restricts the possible adapter modules to the existing
lockit-*-adapter
family. My use case is I have a project that uses knex to access a postgress database and I'd like to keep all of my table migrations managed in the same place. So I'm a little wary about letting thelockit-sql-adapter
sync a table under the hood with sequelize.