Skip to content

Commit 636fa78

Browse files
authored
Update README.md - ready for review
1 parent 6cb255f commit 636fa78

File tree

1 file changed

+9
-9
lines changed
  • schema_design/SchemaExamples/ChatSystem

1 file changed

+9
-9
lines changed

schema_design/SchemaExamples/ChatSystem/README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@ The following key structures are used:
3232
| PK | SK | Sample Attributes |
3333
| ----------- | ----------- | ----------- |
3434
| User:UserA | 2023-04-01T14:00:00.001Z | RoomID, Comment, CreatedAt |
35-
| Room:Art | meta | CreatedBy |
35+
| Room:Art | `meta` | CreatedBy |
3636

3737
- GSI
3838
- Partition key (RoomID)
3939
- \<RoomID\>
4040
- Sort key (CreatedAt)
4141
- \<timestamp\>
4242

43-
- Examples:
43+
- Example:
4444

4545
| PK | SK | Sample Attributes |
4646
| ----------- | ----------- | ----------- |
@@ -57,18 +57,18 @@ The document covers 9 access patterns. For each access pattern, we provide:
5757

5858
| Access pattern | Base table/GSI | Operation | Partition key value | Sort key value | Other conditions/Filters |
5959
| ----------- | ----------- | ----------- | ----------- | ----------- | ----------- |
60-
| createChatRoom | Base table | PutItem | PK=\<RoomID\> | SK="Meta" | if not exists |
61-
| deleteChatRoom | Base table | DeleteItem | PK=\<RoomID\> | SK="Meta" | createdBy=UserID |
62-
| joinChatRoom | Base table | PutItem | PK=\<UserID\> | SK="Join"\<roomID\> | |
63-
| leaveChatRoom | Base table | DeleteItem | PK=\<UserID\> | SK="Join"\<roomID\> | |
60+
| createChatRoom | Base table | PutItem | PK=\<RoomID\> | SK="meta" | if not exists |
61+
| deleteChatRoom | Base table | DeleteItem | PK=\<RoomID\> | SK="meta" | CreatedBy=\<UserID\> |
62+
| joinChatRoom | Base table | PutItem | PK=\<UserID\> | SK="Join:"\<roomID\> | |
63+
| leaveChatRoom | Base table | DeleteItem | PK=\<UserID\> | SK="Join:"\<roomID\> | |
6464
| addComments | Base table | PutItem | PK=\<UserID\> | SK=\<timestamp\> | |
6565
| getAllComments | GSI | Query | PK=\<RoomID\> | | Limit 1 |
6666
| getLatestComments | GSI | Query | PK=\<RoomID\> | | Limit 10 & ScanIndexForward = false |
67-
| getFromLatestToSpecifiedPositionComments | GSI | Query | PK=\<roomID\> | SK > FromPosition | |
68-
| getFromPositionToPositionComments | GSI | Query | PK=\<roomID\> | SK between FromPosition and ToPosition | |
67+
| getFromLatestToSpecifiedPositionComments | GSI | Query | PK=\<RoomID\> | SK > \<FromPosition\> | |
68+
| getFromPositionToPositionComments | GSI | Query | PK=\<RoomID\> | SK between \<FromPosition\> and \<ToPosition\> | |
6969

7070

71-
Please note: We add “Limit 1” for getLastLoginTimeByCustomerId since GSIs can have duplicate values. GSIs do not enforce uniqueness on key attribute values like the base table does.
71+
Please note: We add “Limit 1” for getAllComments since GSIs can have duplicate values. GSIs do not enforce uniqueness on key attribute values like the base table does.
7272

7373
## Goals
7474

0 commit comments

Comments
 (0)