It provides the function that manages performant many entity objects. Technically, using Normalization.

In the application that uses many entity objects, we sure highly recommend using such as ORM using Normalization.

About more detail, https://redux.js.org/recipes/structuring-reducers/normalizing-state-shape

VergeORM Core Concepts

VergeORM is a library to manage Object-Relational Mapping in the value-type struct.

It provides to store with Normalization and accessing easier way. Basically, If we do Normalization without any tool, accessing would be complicated.

The datastore can be stored anywhere because it’s built by struct type. It allows that to adapt to state-shape already exists.

struct YourAppState {

  // VergeORM's datastore
  struct Database: DatabaseType {

    ...
    // We will explain this later.
  }

  // Put Database anywhere you'd like
  var db: Database = .init()

  ... other states
}

Stores data with normalization

Many applications manage a lot of entities. Single state-tree requires work similar to creating database schema. The state shape is most important, otherwise performance issue will appear when your application grows.

‌ To avoid this, we should do Normalize the State Shape. About Normalizing state shape, Redux documentation explains it so good. VergeORM provides several helper methods to normalize state shape.

Getting Started

Create Database struct

Database struct contains the tables for each Entity. As a struct object, that allows to manage history and it can be embedded on the state that application uses. ‌

Add DatabaseType protocol to your database struct

struct Database: DatabaseType {
}

DatabaseType protocol has several constraints and provides functions with that. To satisfy those constraints, make it like following