Skip to content

Commit e18e344

Browse files
committed
Starting more in-depth documentation
1 parent 092f7df commit e18e344

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Alex DeBrie's [book on the subject](https://www.dynamodbbook.com/).
1818
next weeks / months WITHOUT A CORRESPONDING MAJOR RELEASE. I hope to create a stable release by the end of October.**
1919

2020
**And since this is an early version I would STRONGLY APPRECIATE FEEDBACK! 😀 Please drop me an email at
21-
[email protected], or use the issues in this project**
21+
[email protected], or use the issues in this project**.
2222

2323
Entity Store provides the following:
2424

@@ -42,10 +42,11 @@ If you're deciding on what DynamoDB library to choose you may want to also consi
4242
my own work. When I was looking in 2022 DynamoDB Toolbox didn't support AWS SDK V3, but it does now.
4343
* [One Table](https://github.com/sensedeep/dynamodb-onetable)
4444

45-
The rest of this README includes some examples, but it does **NOT** include full coverage of capabilities. I plan on
46-
writing more documentation later, but until then take a look at
47-
the [integration tests](https://github.com/symphoniacloud/dynamodb-entity-store/tree/main/test/integration), [source
48-
code](/src/lib), or [Type Docs](https://symphoniacloud.github.io/dynamodb-entity-store/).
45+
The rest of this README provides an overview of how to use the library. For more details see:
46+
* [The manual](./documentation/manual.md)
47+
* [integration tests](https://github.com/symphoniacloud/dynamodb-entity-store/tree/main/test/integration)
48+
* [source code](/src/lib)
49+
* [Type Docs](https://symphoniacloud.github.io/dynamodb-entity-store/)
4950

5051
## Example 1: Single Table Design, without indexes
5152

@@ -95,7 +96,7 @@ export const SHEEP_ENTITY = createEntity(
9596
// Type name
9697
'sheep',
9798
// Type predicate, used in standard parser
98-
function(x: unknown): x is Sheep {
99+
function(x: DynamoDBValues): x is Sheep {
99100
const candidate = x as Sheep
100101
return candidate.breed !== undefined &&
101102
candidate.name !== undefined &&
@@ -115,6 +116,7 @@ We only need to create this object **once per type** of entity in our applicatio
115116
* **Optional:** express how to convert an object to a DynamoDB record ("formatting")
116117
* **Optional:** Create Global Secondary Index (GSI) key values
117118

119+
> A complete discussion of _Entities_ is available in [the manual, here](./documentation/1-Entities.md).
118120
119121
We can now call `.for(...)` on our entity store. This returns an object that implements [`SingleEntityOperations`](https://symphoniacloud.github.io/dynamodb-entity-store/interfaces/SingleEntityOperations.html) - **this is the object that you'll likely work with most when using this library**.
120122

examples/src/example1Sheep.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import {
22
createEntity,
33
createStandardSingleTableStoreConfig,
44
createStore,
5+
DynamoDBValues,
56
rangeWhereSkBetween
67
} from '@symphoniacloud/dynamodb-entity-store'
78

@@ -13,7 +14,7 @@ export interface Sheep {
1314
}
1415

1516
// Type predicate for Sheep type
16-
const isSheep = function (x: unknown): x is Sheep {
17+
const isSheep = function (x: DynamoDBValues): x is Sheep {
1718
const candidate = x as Sheep
1819
return candidate.breed !== undefined && candidate.name !== undefined && candidate.ageInYears !== undefined
1920
}

test/examples/sheepTypeAndEntity.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import { createEntity } from '../../src/lib/support/entitySupport'
22
import { rangeWhereSkBetween } from '../../src/lib/support/querySupport'
3+
import { DynamoDBValues } from '../../src/lib'
34

45
export interface Sheep {
56
breed: string
67
name: string
78
ageInYears: number
89
}
910

10-
export function isSheep(x: unknown): x is Sheep {
11+
export function isSheep(x: DynamoDBValues): x is Sheep {
1112
const candidate = x as Sheep
1213
return candidate.breed !== undefined && candidate.name !== undefined && candidate.ageInYears !== undefined
1314
}

0 commit comments

Comments
 (0)