All Projects → yury-dymov → Redux Object

yury-dymov / Redux Object

Licence: mit
Builds complex JS object from normalized redux store. Best works with json-api-normalizer

Programming Languages

javascript
184084 projects - #8 most used programming language

Labels

Projects that are alternatives of or similar to Redux Object

Npdynamodb
A Node.js Simple Query Builder and ORM for AWS DynamoDB
Stars: ✭ 113 (-13.08%)
Mutual labels:  orm
Ormlite Android
ORMLite Android functionality used in conjunction with ormlite-core
Stars: ✭ 1,564 (+1103.08%)
Mutual labels:  orm
Js Data
Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser. Main Site: http://js-data.io, API Reference Docs: http://api.js-data.io/js-data
Stars: ✭ 1,599 (+1130%)
Mutual labels:  orm
Dtcqueuebundle
Symfony2/3/4/5 Queue Bundle (for background jobs) supporting Mongo (Doctrine ODM), Mysql (and any Doctrine ORM), RabbitMQ, Beanstalkd, Redis, and ... {write your own}
Stars: ✭ 115 (-11.54%)
Mutual labels:  orm
Belleorm
A Sqlite ORM library for Kotlin, Java & Android.
Stars: ✭ 117 (-10%)
Mutual labels:  orm
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-4.62%)
Mutual labels:  orm
Datafiles
A file-based ORM for Python dataclasses.
Stars: ✭ 113 (-13.08%)
Mutual labels:  orm
Lealone
极具创新的面向微服务和 OLTP/OLAP 场景的单机与分布式关系数据库
Stars: ✭ 1,802 (+1286.15%)
Mutual labels:  orm
Tik4net
Manage mikrotik routers with .NET C# code via ADO.NET like API or enjoy O/R mapper like highlevel api.
Stars: ✭ 118 (-9.23%)
Mutual labels:  orm
Android Demos
Android develop demos
Stars: ✭ 126 (-3.08%)
Mutual labels:  orm
Dapper Samples
Tutorial samples that shows how to use Dapper .NET
Stars: ✭ 116 (-10.77%)
Mutual labels:  orm
Efcore
EF Core is a modern object-database mapper for .NET. It supports LINQ queries, change tracking, updates, and schema migrations.
Stars: ✭ 10,838 (+8236.92%)
Mutual labels:  orm
Flywheel
Object mapper for Amazon's DynamoDB
Stars: ✭ 124 (-4.62%)
Mutual labels:  orm
Servicestack.ormlite
Fast, Simple, Typed ORM for .NET
Stars: ✭ 1,532 (+1078.46%)
Mutual labels:  orm
Nestjs Sequelize Jwt
Nest + Sequelize + jwt
Stars: ✭ 127 (-2.31%)
Mutual labels:  orm
Tornado Sqlalchemy
SQLAlchemy support for Tornado
Stars: ✭ 112 (-13.85%)
Mutual labels:  orm
Sqli
orm sql interface, Criteria, CriteriaBuilder, ResultMapBuilder
Stars: ✭ 1,644 (+1164.62%)
Mutual labels:  orm
Sworm
a write-only ORM for Node.js
Stars: ✭ 128 (-1.54%)
Mutual labels:  orm
Fluent Nhibernate
Fluent NHibernate!
Stars: ✭ 1,611 (+1139.23%)
Mutual labels:  orm
Codeigniter Model
CodeIgniter 3 Active Record (ORM) Standard Model with Laravel Eloquent & Yii2 AR like
Stars: ✭ 124 (-4.62%)
Mutual labels:  orm

redux-object

npm version Downloads Build Status Coverage Status

Builds complex JS object from normalized redux store. Best works with json-api-normalizer.

DEMO - https://yury-dymov.github.io/json-api-react-redux-example/

Demo sources and description - https://github.com/yury-dymov/json-api-react-redux-example

API

Library provides build function, which takes 4 parameters: redux state part, object type, ID or an array of IDs or null, and options.

If ID is provided in a form of array, multiple objects are fetched. If ID is null, all objects of selected type are fetched.

Option Default Description
eager false Controls lazy loading for the child relationship objects. By default, lazy loading is enabled.
ignoreLinks false redux-object doesn't support remote objects. This option suppresses the exception thrown in case user accesses a property, which is not loaded to redux store yet.
includeType false Include the record type as a property 'type' on each result. This is particularly useful for identifying the record type returned by a polymorphic relationship.
import build from 'redux-object';

/*
state:
{
  data: {
    post: {
      "2620": {
        attributes: {
          "text": "hello",
          "id": 2620
        },
        relationships: {
          daQuestion: {
            id: "295",
            type: "question"
          },
          liker: [{
              id: "1",
              type: "user"
            }, {
              id: "2",
              type: "user",
            }, {
              id: "3",
              type: "user"
            }
          ],
          comments: []
        }
      }
    },
    question: {
      "295": {
        attributes: {
          text: "hello?"
        }
      }
    },
    user: {
      "1": {
        attributes: {
          id: 1,
          name: "Alice"
        }
      },
      "2": {
        attributes: {
          id: 2,
          name: "Bob"
        }
      },
      "3": {
        attributes: {
          id: 3,
          text: "Jenny"
        }
      }
    },
    meta: {
      'posts/me': {
        data: {
          post: '2620'
        }
      }
    }
  }
};
*/

const post = build(state.data, 'post', '2620');

console.log(post.id); // -> 2620
console.log(post.text); // -> hello
console.log(post.daQuestion); // -> { id: 295, text: "hello?" }
console.log(post.liker.length); //-> 3
console.log(post.liker[0]); // -> { id: 1, name: "Alice" }

// Other examples

const post = build(state.data, 'post', '2620', { eager: true });
const post = build(state.data, 'post', '2620', { eager: false, ignoreLinks: true });

Child objects are lazy loaded unless eager option is explicitly provided.

License

MIT (c) Yury Dymov

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].