1.0.0 • Published 7 years ago
@alvilio/realm-orm v1.0.0
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 |
1.0.0
7 years ago