Closed hasanAjsf closed 3 years ago
Hi @hajsf, using a key-value store for this use-case will require a mapping from application level data model to key-value data model. The simplest mapping would be involve using identifiers for orders e.g. keys of the form "orderHeader_ID" and the value being the entire serialised object. Same for order lines "orderLine_OrderID_orderLineID".
Then you can retrieve a specific orderHeader by its id by using "orderHeader123" as key for instance. Or to scan over a range of orders using "orderHeader" as prefix.
Also possible to retrieve order lines for a specific order header by using prefix "orderLine_123". Or even retrieve a specific order line by having the order header and order line identifiers.
This way at the application level you can recalculate the Amount of any order and submit the new entire object to immudb.
I'd suggest to start with this coarse-grained mapping to get familiarised. But it's possible to use fine-grained mapping by which each attribute of an object is mapped to its own key-value pair.
We're working on providing SQL capabilities to immudb in the near future, using a simple relational data model will be easier for this type of use cases.
Thanks for asking
Travis alot
I want to connect with 2 structs (let's say tables) together, as:
Example:
At a late stage, the Qty of
line2
is required to be updated to 2, so the system required to recalculate the following, based on the same logic above:Appreciate your support. thanks