@alvilio/realm-orm

It is orm to work with realm data bases

Usage no npm install needed!

<script type="module">
  import alvilioRealmOrm from 'https://cdn.skypack.dev/@alvilio/realm-orm';
</script>

README

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


Name

Description

Params
delete Delete one or more items ids, string or string id array of items to delete
findById Find a model by id id, string
find Find a model filter, realm string filter
save Save or update a model, if model has id property then update else create model, object value of the model