-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathexample.jsonb
71 lines (62 loc) · 1.81 KB
/
example.jsonb
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
JSONB_MACRO_DEFINE(BUFMAX, 2)
JSONB_MACRO_DEFINE(double(a), (a) * (a))
JSONB_MACRO_DEFINE(sum(a, b), (a) + (b))
JSONB_INCLUDE_HEADER(math.h)
JSONB_INCLUDE_HEADER(../inc/test.h)
JSONB_ENUM_START(gender_t)
JSONB_ENUM_FIELD(Male, 1)
JSONB_ENUM_FIELD(Female)
JSONB_ENUM_END(gender_t)
JSONB_STRUCT_START(red_t)
JSONB_FIELD(r, uint8_t)
JSONB_STRUCT_END(red_t)
JSONB_STRUCT_START(green_t)
JSONB_FIELD(g, uint8_t)
JSONB_STRUCT_END(green_t)
JSONB_STRUCT_START(blue_t)
JSONB_FIELD(b, uint8_t)
JSONB_STRUCT_END(blue_t)
JSONB_STRUCT_START(person_t)
JSONB_STRING(name, 32)
JSONB_FIELD(gender, gender_t)
JSONB_FIELD(married, bool)
JSONB_FIELD(height, double)
JSONB_FIELD(weight, float)
JSONB_FIELD(age, uint8_t)
JSONB_FIELD(birthday, uint64_t)
JSONB_STRING(hometown, 32)
JSONB_FIELD(id, int64_t)
JSONB_STRUCT_END(person_t)
JSONB_STRUCT_START(class_t)
JSONB_STRING(name, 32)
JSONB_FIELD(row, char)
JSONB_FIELD(col, short)
JSONB_FIELD(total, long)
JSONB_FIELD(id, long)
JSONB_STRUCT_END(class_t)
JSONB_UNION_START(union_test_t, condition)
JSONB_UNION_FIELD(a, char)
JSONB_UNION_FIELD(b, short)
JSONB_UNION_FIELD(c, int)
JSONB_UNION_FIELD(d, long)
JSONB_UNION_END(union_test_t, condition)
JSONB_STRUCT_START(student_t)
JSONB_FIELD(person, person_t)
JSONB_FIELD(class, class_t)
JSONB_FIELD(union_test, union_test_t)
JSONB_STRING_ARRAY(subjects, BUFMAX, 32)
JSONB_FIELD_ARRAY(scores, BUFMAX, uint16_t)
JSONB_FIELD_ARRAY(teachers, BUFMAX, person_t)
JSONB_FIELD_ARRAY(multi_array_test, 4, 3, 2, int)
JSONB_FIELD_ARRAY(multi_array_class_t, 2, 2, class_t)
JSONB_ANON_UNION_START(color)
JSONB_UNION_FIELD(red, red_t)
JSONB_UNION_FIELD(green, green_t)
JSONB_UNION_FIELD(blue, blue_t)
JSONB_ANON_UNION_END(color)
JSONB_ANON_STRUCT_START()
JSONB_FIELD(_red, red_t)
JSONB_FIELD(_green, green_t)
JSONB_FIELD(_blue, blue_t)
JSONB_ANON_STRUCT_END()
JSONB_STRUCT_END(student_t)