Skip to content
This repository was archived by the owner on Jun 22, 2021. It is now read-only.

Commit 48744b9

Browse files
committed
docs(readme): Corrects config.
1 parent 54a642c commit 48744b9

File tree

1 file changed

+18
-5
lines changed

1 file changed

+18
-5
lines changed

readme.md

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,28 @@ export interface TodoEntity extends TodoId {
2626

2727
```ts
2828
import FacadeConfig from '@js-entity-repos/knex/dist/Config';
29-
import connectToCollection from '@js-entity-repos/knex/dist/utils/connectToCollection';
29+
import connectToDb from '@js-entity-repos/knex/dist/utils/connectToDb';
3030

3131
const todoFacadeConfig: FacadeConfig = {
32-
collection: connectToCollection({
33-
collectionName: 'todos',
34-
dbName: 'todoapp',
35-
url: 'knexdb://localhost:27017',
32+
constructDocument: (id, patch) => {
33+
// Converts an entity to a document for the database.
34+
return { ...patch, ...id }
35+
},
36+
constructEntity: (document) => {
37+
// Converts a document from the database to an entity.
38+
return document;
39+
},
40+
db: connectToDb({
41+
client: 'mysql',
42+
connection: {
43+
database: 'todoapp',
44+
host: '127.0.0.1',
45+
password: 'pword',
46+
user: 'todouser',
47+
},
3648
}),
3749
entityName: 'todo',
50+
tableName: 'todos',
3851
};
3952
```
4053

0 commit comments

Comments
 (0)