Skip to content

Commit 3a3cf49

Browse files
committed
chapter 04: adding role and header interfaces to use in entityManager
1 parent 0a29dff commit 3a3cf49

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* In order to improve the understanding of this code, this file it is supposing to implement the following interfaces:
3+
*
4+
* interface PersistsEntitiesInterface {
5+
* function persist(entity);
6+
*
7+
* function flush();
8+
* }
9+
*
10+
* interface HasUnitOfWorkInterface {
11+
* function getUnitOfWork(name);
12+
* }
13+
*
14+
* interface EntityManagerInterface extends PersistsEntitiesInterface, HasUnitOfWorkInterface {
15+
*
16+
* }
17+
*
18+
* Quack Quack Quack 🦆 typing :D
19+
*/
20+
21+
/**
22+
* @implements {EntityManagerInterface}
23+
*/
24+
function entityManager() {
25+
function persist(entity) {
26+
// make something here...
27+
}
28+
29+
function flush() {
30+
// make something here
31+
}
32+
33+
function getUnitOfWork() {
34+
// make something here
35+
}
36+
37+
return {
38+
persist,
39+
flush,
40+
getUnitOfWork,
41+
};
42+
}
43+
44+
module.exports = entityManager;

0 commit comments

Comments
 (0)