-
Notifications
You must be signed in to change notification settings - Fork 2
/
sandbox.txt
85 lines (45 loc) · 1.68 KB
/
sandbox.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
# Examples for converting
SELECT * FROM CustomerTable
WHERE CustomerTable.cno = 5
HgDB.query(CustomerTable.eq.cno(5))
// should we rename "query" to "select"?
SELECT cname, cno FROM CustomerTable
WHERE CustomerTable.cno = 5
HgDB.query(CustomerTable.eq.cno(5)).
// TODO this syntax (make it efficient too by selecting index)
// OrderTbl.query(OrderTbl.on.ono, 1020);
// static class solution with FieldExtractableValue
HgQuery.query(OrderTbl.eq.ono(5), OrderTbl.eq.cno(null));
HgQuery.query(OrderTbl.lt.ono(5));
HgQuery.query(OrderTbl.predicate.ono(value -> value < 5));
HgQuery.query(OrderTbl.predicate.ono(new HgPredicate<Integer>() {
public boolean predicate(Integer value) {
return value < 5;
}
}));
// original table solution
OrderTbl.query(OrderTbl.on.ono, 5, OrderTbl.on.cno, null);
OrderTbl.query(OrderTbl.equal.ono(5), OrderTbl.equal.cno(null));
// All FieldExtractable instances for each field in "X"
XTable.field.*
// All FieldExtractableJoinInput instances
XTable.on.*
// All implicit predicates
XTable.eq.*
XTable.ne.*
XTable.lt.*
XTable.le.*
XTable.gt.*
XTable.ge.*
// All explicit predicates specified by user using HgPredicate
XTable.predicate.*
public interface HgPredicate<T> {
public boolean predicate(T val);
}
CustomerTable.on.ono().as(CustomerTable.createAlias());
CustomerTable.on.ono()
CustomerTable.as(...).on.ono(); // is this feasible?
TableID<Person> parent = PersonTable.createAlias();
CustomerTable.as(parent).on.ono();
CustomerTable.eq.ono(42); // this is bad
CustomerTable.ono.eq(42); // reads better, makes more sense