loopbackio / loopback-next

LoopBack makes it easy to build modern API applications that require complex integrations.
https://loopback.io
Other
4.93k stars 1.06k forks source link

[Epic] KeyValue repository #1447

Closed bajtos closed 6 years ago

bajtos commented 6 years ago

So far, LB4 persistence story is all about CRUD. Key-value stores are another common scenario we should support.

LoopBack 3.x introduced KeyValue API and Redis + eXtremeScale connectors.

For LoopBack 4, we need to add Repository implementations for KeyValue API and verify that all pieces work together as expected.

Scope

The use case to drive the features: a "shopping cart" component used on an e-shop platform like Walmart.

raymondfeng commented 6 years ago

The runtime support is added - https://github.com/strongloop/loopback-next/pull/1539

bajtos commented 6 years ago

Please note that the runtime implementation has a flaw we need to address, preferably before considering this feature as done. See https://github.com/strongloop/loopback-next/pull/1539#discussion_r209892539:

Ideally, I'd like our DefaultKeyValueRepository to leverage the same mechanism that DefaultCrudRepository uses:

  • The backing model has the same name as the LB4 model.
  • If the datasource already has a backing model defined, then we reuse it.
  • When defining a new backing model, LB4 property definition is converted to juggler schema.
raymondfeng commented 6 years ago

Adding docs - https://github.com/strongloop/loopback-next/pull/1654

dhmlau commented 6 years ago

The docs task has been created and PR has merged. Closing this task as resolved.