You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Love the general approach of resourceful, but just wondering why actual storage engines are implemented within the core library? Even though I primarily use CouchDB, it really just does make that much sense (to me) to have a library that handles abstract model definition implement storage adapters within the library itself?
This for me is somewhat reminiscent of earlier versions of winston which included an implementation of the loggly reporter and package dependencies to make it work.
Taking the example in the readme, I'd much rather do something like the following to wire up the storage engine:
varresourceful=require('resourceful'),couchStorage=require('resourceful-couchdb');varCreature=resourceful.define('creature',function(){//// Specify a storage engine//this.use(couchStorage);//// Specify some properties with validation//this.string('diet');this.bool('vertebrate');this.array('belly');//// Specify timestamp properties//this.timestamps();});//// Now that the `Creature` prototype is defined// we can add custom logic to be available on all instances//Creature.prototype.feed=function(food){this.belly.push(food);};
You could additionally support your existing implementation by implementing an engine registry within resourceful, so that some initialization code such as below would result in the readme code working as is:
Hey Guys,
Love the general approach of resourceful, but just wondering why actual storage engines are implemented within the core library? Even though I primarily use CouchDB, it really just does make that much sense (to me) to have a library that handles abstract model definition implement storage adapters within the library itself?
This for me is somewhat reminiscent of earlier versions of winston which included an implementation of the loggly reporter and package dependencies to make it work.
Taking the example in the readme, I'd much rather do something like the following to wire up the storage engine:
You could additionally support your existing implementation by implementing an engine registry within resourceful, so that some initialization code such as below would result in the readme code working as is:
I'd certainly be happy to work on this kind of implementation if you felt that it was a direction that you wanted to take resourceful in.
Cheers,
Damon.
The text was updated successfully, but these errors were encountered: