Assuming there's a model Foo that looks like this:
var Schema = require('decaf-mysql').Schema;
Schema.add({
name : 'Foo',
primaryKey : 'fooId',
fields : [
{ name : 'fooId', type : 'int', autoIncrement : true },
{ name : 'name', type : 'varchar', size : 255 },
{ name : 'categoryId', type : 'int', defaultValue : 0 }
]
});
Running the following selector returns all values:
var id = undefined;
var result = Schema.find('Foo', {fooId: id});
result contains all rows in Foo.
A better approach would be to throw an error that the selector is undefined or return empty perhaps?
Assuming there's a model
Foothat looks like this:Running the following selector returns all values:
resultcontains all rows inFoo.A better approach would be to throw an error that the selector is undefined or return empty perhaps?