File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -10,28 +10,32 @@ export const App = () => {
10
10
}
11
11
12
12
const config = {
13
- // Schema is optional. Add as much or as little as you want.
13
+ // Schema is only used to enforce
14
+ // unique constraints and relationships.
15
+ // It is not a type system, yet.
14
16
schema : {
15
- user : { name : { type : 'string' } } ,
16
17
project : { name : { unique : 'identity' } } ,
17
18
todo : {
18
19
// refs are relationships
19
20
project : { type : 'ref' } ,
20
21
owner : { type : 'ref' }
21
22
}
22
23
} ,
24
+ // Initial data let's you conveniently transact some
25
+ // starting data on DB creation to hydrate your components.
23
26
initialData : [
24
27
{
25
28
todoFilter : {
26
- // identity is a special attribute for user generated ids
27
- // E.g. this is a setting that should be easy to lookup by name
29
+ // identity is a special unique attribute for user generated ids
30
+ // E.g. todoFilters are settings that should be easy to lookup by their identity
28
31
identity : 'todoFilters' ,
29
32
showCompleted : true ,
30
33
project : 0
31
34
}
32
35
} , {
33
36
user : {
34
- // negative numbers can be used as temporary ids in a transaction
37
+ // Negative numbers can be used as temporary ids in a transaction.
38
+ // Use them to relate multiple entities together at once.
35
39
id : - 1 ,
36
40
name : 'Stella'
37
41
}
@@ -87,7 +91,7 @@ const NewTodo = () => {
87
91
transact ( [ {
88
92
todo : {
89
93
name : e . target . elements [ 'todo-name' ] . value ,
90
- createdAt : new Date
94
+ createdAt : new Date ( )
91
95
}
92
96
} ] )
93
97
e . target . reset ( )
Original file line number Diff line number Diff line change @@ -24,13 +24,10 @@ const App = () => {
24
24
25
25
exports . App = App ;
26
26
const config = {
27
- // Schema is optional. Add as much or as little as you want.
27
+ // Schema is only used to enforce
28
+ // unique constraints and relationships.
29
+ // It is not a type system, yet.
28
30
schema : {
29
- user : {
30
- name : {
31
- type : 'string'
32
- }
33
- } ,
34
31
project : {
35
32
name : {
36
33
unique : 'identity'
@@ -46,17 +43,20 @@ const config = {
46
43
}
47
44
}
48
45
} ,
46
+ // Initial data let's you conveniently transact some
47
+ // starting data on DB creation to hydrate your components.
49
48
initialData : [ {
50
49
todoFilter : {
51
- // identity is a special attribute for user generated ids
52
- // E.g. this is a setting that should be easy to lookup by name
50
+ // identity is a special unique attribute for user generated ids
51
+ // E.g. todoFilters are settings that should be easy to lookup by their identity
53
52
identity : 'todoFilters' ,
54
53
showCompleted : true ,
55
54
project : 0
56
55
}
57
56
} , {
58
57
user : {
59
- // negative numbers can be used as temporary ids in a transaction
58
+ // Negative numbers can be used as temporary ids in a transaction.
59
+ // Use them to relate multiple entities together at once.
60
60
id : - 1 ,
61
61
name : 'Stella'
62
62
}
You can’t perform that action at this time.
0 commit comments