Skip to content
Kjell Nilsson edited this page Oct 10, 2018 · 5 revisions

How can I store the data somewhere else?

The LOF has the concept of Entity with Attributes. It also has the option to use Relationships between these Entities. Every entity has also the concept of rows that each is identifiable by an id. In the client these are represented as regular Objective-J objects with attributes. A query is usually done with CPPredicates. The LOF has an Object Store layer that handles how the data is stored. The current implementation talks with a backend using a proprietary JSON format. The objj-backend is an open source backend implementation in Objective-J that talks this proprietary JSON format. Currently the backend stores the data in a Postgres database but it is easy to implement other sql or even no sql databases as an adaptor in the backend. There are two ways to store the data somewhere else.

  • Write your own Object Store for the LOF framework. This runs on the client and can talk to your own backend. This has to deal with converting the data to objects when fetching and handle the changed data that needs to be sent to the backend when saving. It is also possible to write an Object Store that will save the data in the browser's local storage instead of sending it to a remote backend.

  • Write your own Database Adaptor in the objj-backend. This is just an Objective-J class that has to implement a protocol. This adaptor handles the communication with the database. The queries are done with a CPPredicate so the adaptor has to be able to convert a CPPredicate to whatever the database uses. You can use any database but it has to be able to map the concepts of Entity with Attributes and rows that is identifiable with an id as described above. It can be a sql database or a no sql database. You can even store the data in regular files like a xml files or plain flat files.

Sure it is easier to use a rational database to store the data as the concepts match very well but as described above it is possible to use almost anything. The LOF framework has a lot of features that will make your life easier but you have to remember that it also has its limitations. Don't use it if your data don't match the concepts above.

Clone this wiki locally