Frontend Relational Immutable Database

Intro

Two-way-rest is powered by a frontend pseudo-relational database called globe. Every reducer's state is a globe, and changes to the globe are generally made by passing it either an object, or an array of objects.

Updating the globe

The globe is updated through objects and array merges. One problem with this approach is that nothing is ever deleted.
example:

Globe: Map { people: Map {name: 'Jim', friends: List [1, 2, 3], id: 1}}
Merging Object {name: 'Jim', friends: [5, 6, 7], id: 1}
==>
Globe: Map { people: Map {name: 'Jim', friends: List [1, 2, 3, 5, 6, 7], id: 1} }

To get the desired array of just [5, 6, 7], we tap into the actioncycle, and delete the array in the state manually before merging the new object. We can accomplish this using the customAction function.

Deleting through properties

If you need to update the globe with information regarding deleted instances, you can set a non-false deleted_at property for that instance.
example:

Globe: Map { people: Map {name: 'Jim', id: 1}}
Merging Object {name: 'Jim', id: 1, deleted_at: true}
==>
Globe: Map { people: Map {name: 'Jim', id: 1, deleted_at: true} }

results matching ""

    No results matching ""