@parch-js/orm

0.0.4 • Public • Published

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.

Readme

Keywords

Package Sidebar

Install

npm i @parch-js/orm

Weekly Downloads

1

Version

0.0.4

License

MIT

Last publish

Collaborators

  • dylanf