Skip to content

Commit 6c9f972

Browse files
committed
docs
1 parent bee19ba commit 6c9f972

4 files changed

Lines changed: 18 additions & 5 deletions

File tree

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,5 +20,4 @@
2020
# Go workspace file
2121
go.work
2222
.idea/
23-
.id2/
2423

README.md

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,28 +54,42 @@ import org.bson.codecs.pojo.annotations.BsonProperty;
5454
/**
5555
The org person
5656
**/
57-
class OrgPerson {
57+
entity OrgPerson {
5858
59-
data String uuid as u = Utils.newUID();
59+
index (uuid asc) unique;
60+
index (name asc) unique;
61+
index (email asc) unique sparse;
62+
index (friendIds asc) sparse;
63+
64+
data String uuid as u = ~Utils.newUID()~;
6065
6166
data String orgId as o;
6267
6368
data String name as n;
6469
6570
data String email as e;
6671
67-
}
72+
data Status status as st = ~Status.PENDING~;
73+
74+
data ~List<String>~ friendIds as f = ~new ArrayList<>()~;
75+
76+
data ~List<Address>~ addresses as a = ~new ArrayList<>()~;
77+
78+
...
6879
6980
```
7081

71-
The output is: [output java](internal/sample_output.java)
82+
The output is: [output java](samples/sample_input.java)
7283

7384
```
7485
Usage of the output class:
7586
7687
var org = OrgPerson.builder().setOrgId("45").setName("test").build();
88+
89+
// Update the org. Note the original is not modified.
7790
var orgUpdate = org.copy().setName("newName").build();
7891
92+
7993
```
8094

8195
# Examples

0 commit comments

Comments
 (0)