0.0.4 • Published 6 years ago

@parch-js/orm v0.0.4

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

ORM

Build Status Coverage Status bitHound Overall Score

Simple DSL for accessing data stored in a SQL store.

Installation

npm install --save @parch-js/orm

Usage

Models passed to the constructor must come from a sequelize definition

import ORM from "@parch-js/orm";

const orm = new ORM({
  User: SequelizeDefinedUserModel
});

return orm.findAll("user",
  { firstName: "foo" },
  { attributes: ["firstName"] }
).then(users => {});

return orm.findOne("user", 1,
  { attributes: ["firstName"] }
)then(user => {});

return orm.queryRecord("user",
  { firstName: "foo" },
  { attributes: ["firstName"] }
).then(user => {});

return orm.createRecord("user", { firstName: "bar"}).then(user => {});
return orm.updateRecord("user", 1, { firstName: "baz" }).then(user => {});
return orm.destroyRecord("user", 1).then(() => {});

Read the docs for more in depth usage.