1.0.0 • Published 5 years ago

@alvilio/realm-orm v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

realm-orm

It is orm to work with realm data bases

How use

1- Define your model

import { Model } from "@alvilio/realm-orm/dist";

const Category = {
  name: "Category",
  properties: {
    name: "string",
    color: "string"
  }
};

export default Model(Category);

2- Use methods

import { Category } from "myModels";

const category = {
  name: "foo",
  color: "red"
};

Category.instance()
  .save(category)
  .then(() => {
    // Succes response
  })
  .catch(error => {
    // Fail response
  });

Methods

Model class

NameDescriptionParams
deleteDelete one or more itemsids, string or string id array of items to delete
findByIdFind a model by idid, string
findFind a modelfilter, realm string filter
saveSave or update a model, if model has id property then update else createmodel, object value of the model