forked from sqlc-dev/sqlc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcodegen.proto
More file actions
144 lines (118 loc) · 2.88 KB
/
codegen.proto
File metadata and controls
144 lines (118 loc) · 2.88 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
syntax = "proto3";
package plugin;
option go_package = "github.com/kyleconroy/sqlc/internal/plugin";
message File
{
string name = 1 [json_name="name"];
bytes contents = 2 [json_name="contents"];
}
message Override {
// name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type`
string code_type = 1 [json_name="code_type"];
// name of the type to use, e.g. `text`
string db_type = 3 [json_name="db_type"];
// True if the override should apply to a nullable database type
bool nullable = 5 [json_name="nullable"];
// fully qualified name of the column, e.g. `accounts.id`
string column = 6 [json_name="column"];
Identifier table = 7 [json_name="table"];
string column_name = 8 [json_name="column_name"];
PythonType python_type = 9;
}
message PythonType
{
string module = 1;
string name = 2;
}
message Settings
{
string version = 1 [json_name="version"];
string engine = 2 [json_name="engine"];
repeated string schema = 3 [json_name="schema"];
repeated string queries = 4 [json_name="queries"];
map<string, string> rename = 5 [json_name="rename"];
repeated Override overrides = 6 [json_name="overrides"];
// TODO: Refactor codegen settings
PythonCode python = 8;
}
message PythonCode
{
bool emit_exact_table_names = 1;
bool emit_sync_querier = 2;
bool emit_async_querier = 3;
string package = 4;
string out = 5;
}
message Catalog
{
string comment = 1;
string default_schema = 2;
string name = 3;
repeated Schema schemas = 4;
}
message Schema
{
string comment = 1;
string name = 2;
repeated Table tables = 3;
repeated Enum enums = 4;
}
message Enum
{
string name = 1;
repeated string vals = 2;
string comment = 3;
}
message Table
{
Identifier rel = 1;
repeated Column columns = 2;
string comment = 3;
}
message Identifier
{
string catalog = 1;
string schema = 2;
string name = 3;
}
message Column
{
string name = 1;
bool not_null = 3;
bool is_array = 4;
string comment = 5;
int32 length = 6;
bool is_named_param = 7;
bool is_func_call = 8;
// XXX: Figure out what PostgreSQL calls `foo.id`
string scope = 9;
Identifier table = 10;
string table_alias = 11;
Identifier type = 12;
string data_type = 13;
}
message Query
{
string text = 1 [json_name="text"];
string name = 2 [json_name="name"];
string cmd = 3 [json_name="cmd"];
repeated Column columns = 4 [json_name="columns"];
repeated Parameter params = 5 [json_name="parameters"];
repeated string comments = 6 [json_name="comments"];
string filename = 7 [json_name="filename"];
}
message Parameter
{
int32 number = 1 [json_name="number"];
Column column = 2 [json_name="column"];
}
message CodeGenRequest
{
Settings settings = 1 [json_name="settings"];
Catalog catalog = 2 [json_name="catalog"];
repeated Query queries = 3 [json_name="queries"];
}
message CodeGenResponse
{
repeated File files = 1 [json_name="files"];
}