modella-glint
Modella Storage Adapter for Glint Adapters
install
npm install modella-glint
usage
setup
var model = ;var Storage = ;var Adapter = ;var Ajax = ; var adapter = ;var storage = Storageadapter;
model definition (schema)
var User = ; User;
model instance
var user = ; userid'hanswurst' name'hans' ; user;
model functions
load(id, fn)
called on model
User;
find(query, fn)
called on model
query is dependent on the used adapter.
e.g. for glint-adapter-fs
, use the mingo syntax.
User;
instance functions
save(fn)
called on instance
note: unlike described in the adapter plugin guide, this implementation requires the id to be set manually.
if the id()
aka primary()
is not set, it will throw an Error.
user;
remove(fn)
called on instance
note: modella only supports remove
, but NOT delete
, as it is used with glint-adapter
.
user;