Comments (3)
Can you provide a concrete example (including fetching, collections, ...) ?
If I understand you correctly, the table will store all entities.
Then there are multiple collections, where you store a defined query like "age > 18" as key and the matching IDs will be saved in the array as the value.
I think the best approach is still to use Selectors here, which you can define somewhere outside as well, as long as you dont notice a significant performance hit. You could also define custom RXJS operators, if a selector does not suffice.
How would you realise relationships? I don't see how you can realise a generic implementation without a dedicated DSL. Which is certainly technically possible but blows the scope of this library, I think.
from entity-state.
Thanks for getting back to me.
Regarding collections, correct, a map of query parameters to a list of array keys. The query parameters could include page number, page limit, sort key, sort direction, key=>value queries etc. Personally, I use query parameters for my API to accomplish this. I'll look at creating a slackblitz to demonstrate. Ideally I'd like to be able to create one class which can be configured per microservice (at the moment I have a state for each microservice which extends an abstract class - and it is in this vein how I'm most eager to use this plugin).
The purpose of the above which at present I don't see EntityState able to accomplish, is the ability to store multiple collections and share the resources between them. Thus when one collection is updated to retrieve a new version of a resource that is used in another collection, then provided the state is within a reasonable lastUpdated period and is not loading, anywhere referencing the old collection will get the updated resource.
The downsides to the above is that an appropriate cache invalidation strategy would be required as the updated resource may no longer be considered a part of the collection on the server side. That said, it may be that if an entity is updated, all collections are instantly invalidated all the time?
The above strategy would require a different EntityStateModel to remove the Page* properties for example and move that into a CollectionStateModel. At present I'm reinventing the wheel so I'm not sure if this is something you would want as part of this plugin (would it be that reusable? I am following a lose interpretation of the HAL+JSON standard). Would it be better to split out the Page* properties to allow for a custom extension to this plugin? I'll follow your advice here.
As for a ORM, I agree but my question would be whether this should be handled on the service upstream of the state, on the state itself, or between the state and the component? This is a very common use case, and although beyond the scope of this plugin, I do believe any suggestions/recommendations in documentation would be appreciated as I see a large intersection between those requiring this plugin and those requiring ORM of this kind. [This would probably be better tracked in a separate issue with this restricted to the above collection sort/filter request.]
Would a slackblitz or a public repo be better for this demo?
from entity-state.
I would prefer a public repo.
It might get clearer when I see it, but it anyhow it sounds like you want some quite complex things. I think a separate service is needed anyways to separate the functionalities. With the public repo I can give you my opinion if it's a thing for this library and if so you could develop a generic version in a fork? If it's a great feature I'm sure there will be support from us and the community to help you with that.
I don't have a good rule of thumb on where to handle these relationships. I lack the experience with projects with such use cases.
from entity-state.
Related Issues (20)
- Help request / question => how to get an entity by id? HOT 3
- Provide beta release? HOT 15
- Behaviour of remove action HOT 5
- Switch to Jest test framework
- EntityState selectors recalculate when any part of root state was updated HOT 7
- Joining Selectors of two EntityState not working
- Make pagination feature optional HOT 2
- Expose internal.ts to public to easily extend EntityState using same logic HOT 8
- Angular 9 upgrade blocked HOT 2
- Allow numbers as keys HOT 2
- Error: Attempted to get members of a non-class: class Add - NGCC HOT 3
- could not get librabry folder in my project HOT 3
- Adding Api Response to Entities HOT 3
- Change UMD Bundling from ES2015 to ES5? HOT 6
- [Feature request] IdStrategy with nested keys
- State of the library HOT 2
- Provide filter operators for actions e.g. ofEntityAction HOT 1
- Migrate to State Operators HOT 2
- Not working developmentMode, getting ERROR TypeError: Cannot add property VALUE_OF_ID, object is not extensible HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from entity-state.