Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/movesthatmatter/relational-redis-store
A Relational Redis Store supporting Foreign Keys, Indexes and Queues.
https://github.com/movesthatmatter/relational-redis-store
Last synced: about 2 months ago
JSON representation
A Relational Redis Store supporting Foreign Keys, Indexes and Queues.
- Host: GitHub
- URL: https://github.com/movesthatmatter/relational-redis-store
- Owner: movesthatmatter
- License: mit
- Created: 2022-12-02T14:13:06.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-07T16:36:21.000Z (almost 2 years ago)
- Last Synced: 2024-09-01T01:49:08.924Z (4 months ago)
- Language: TypeScript
- Size: 305 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: Readme.md
- License: LICENSE
Awesome Lists containing this project
README
# relational-redis-store
Fully Typed Relational Redis store that supports Foreign Keys, Indexes. This allows queries to combine multiple records into the result out of the box.
# Usage
```
import * as redisSDK from 'handy-redis';
import Store from 'relational-redis-store';type User = {
id: string;
name: string;
}type Game = {
id: string;
players: [User[id], User[id]];
winner?: User[id];
}type CollectionMap = {
users: User;
games: Game;
};const store = new Store(redisSDK.createHandyClient({
url: {REDIS_URL},
}))// Create a Game
store.addItemToCollection('games', {
players: ['a', 'b'],
}, id, {
foreignKeys: {},
});// Retrieve a Game
store.getItemInCollection('games', id);
```
# To Do
- Atomicity
- Transactions