snapshot of https://github.com/sqlc-dev/sqlc.git (main, 2026-09-16; blobs > 131072B omitted)
Some checks failed
kotlin / test (push) Has been skipped
python / test (push) Has been skipped
typescript / test (push) Has been skipped
go / build darwin/amd64 (push) Has been cancelled
go / build linux/amd64 (push) Has been cancelled
go / build windows/amd64 (push) Has been cancelled
go / build darwin/arm64 (push) Has been cancelled
go / build linux/arm64 (push) Has been cancelled
go / build windows/arm64 (push) Has been cancelled
go / test (push) Has been cancelled
go / vuln_check (push) Has been cancelled

This commit is contained in:
upstream-mirror
2026-09-16 02:17:34 +05:00
commit 0f4df23290
7340 changed files with 238743 additions and 0 deletions

View File

@@ -0,0 +1,39 @@
syntax = "proto3";
package analysis;
message Identifier {
string catalog = 1;
string schema = 2;
string name = 3;
}
message Column {
string name = 1;
string original_name = 2;
string data_type = 3;
bool not_null = 4;
bool unsigned = 5;
bool is_array = 6;
int32 array_dims = 7;
string comment = 8;
int32 length = 9; // *int
bool is_named_param = 10;
bool is_func_call = 11;
string scope = 12;
Identifier table = 13;
string table_alias = 14;
Identifier type = 15;
Identifier embed_table = 16;
bool is_sqlc_slice = 17;
}
message Parameter {
int32 number = 1;
Column column = 2;
}
message Analysis {
repeated Column columns = 1;
repeated Parameter params = 2;
}

8
protos/buf.yaml Normal file
View File

@@ -0,0 +1,8 @@
version: v1
name: buf.build/sqlc/sqlc
breaking:
lint:
use:
- DEFAULT
except:
- PACKAGE_VERSION_SUFFIX

132
protos/plugin/codegen.proto Normal file
View File

@@ -0,0 +1,132 @@
syntax = "proto3";
package plugin;
service CodegenService {
rpc Generate (GenerateRequest) returns (GenerateResponse);
}
message File {
string name = 1 [json_name = "name"];
bytes contents = 2 [json_name = "contents"];
}
message Settings {
// Rename message was field 5
// Overides message was field 6
// PythonCode message was field 8
// KotlinCode message was field 9
// GoCode message was field 10;
// JSONCode message was field 11;
reserved 5, 8, 9, 10, 11;
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"];
Codegen codegen = 12 [json_name = "codegen"];
}
message Codegen {
message Process {
string cmd = 1;
}
message WASM {
string url = 1;
string sha256 = 2;
}
string out = 1 [json_name = "out"];
string plugin = 2 [json_name = "plugin"];
bytes options = 3 [json_name = "options"];
repeated string env = 4 [json_name = "env"];
Process process = 5 [json_name = "process"];
WASM wasm = 6 [json_name = "wasm"];
}
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;
repeated CompositeType composite_types = 5;
}
message CompositeType {
string name = 1;
string comment = 2;
}
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;
bool is_sqlc_slice = 13;
Identifier embed_table = 14;
string original_name = 15;
bool unsigned = 16;
int32 array_dims = 17;
}
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"];
Identifier insert_into_table = 8 [json_name = "insert_into_table"];
}
message Parameter {
int32 number = 1 [json_name = "number"];
Column column = 2 [json_name = "column"];
}
message GenerateRequest {
Settings settings = 1 [json_name = "settings"];
Catalog catalog = 2 [json_name = "catalog"];
repeated Query queries = 3 [json_name = "queries"];
string sqlc_version = 4 [json_name = "sqlc_version"];
bytes plugin_options = 5 [json_name = "plugin_options"];
bytes global_options = 6 [json_name = "global_options"];
}
message GenerateResponse {
repeated File files = 1 [json_name = "files"];
}

129
protos/vet/vet.proto Normal file
View File

@@ -0,0 +1,129 @@
syntax = "proto3";
package vet;
message Parameter {
int32 number = 1 [json_name = "number"];
}
message Config {
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"];
}
message Query {
string sql = 1 [json_name = "sql"];
string name = 2 [json_name = "name"];
string cmd = 3 [json_name = "cmd"];
repeated Parameter params = 4 [json_name = "parameters"];
}
message PostgreSQL {
PostgreSQLExplain explain = 1;
}
message PostgreSQLExplain {
Plan plan = 1 [json_name = "Plan"];
map<string, string> settings = 2 [json_name = "Settings"];
Planning planning = 3 [json_name = "Planning"];
message Plan {
string node_type = 1 [json_name = "Node Type"];
string parent_relationship = 2 [json_name = "Parent Relationship"];
string relation_name = 3 [json_name = "Relation Name"];
string schema = 4 [json_name = "Schema"];
string alias = 5 [json_name = "Alias"];
bool parallel_aware = 6 [json_name = "Parallel Aware"];
bool async_capable = 7 [json_name = "Async Capable"];
float startup_cost = 8 [json_name = "Startup Cost"];
float total_cost = 9 [json_name = "Total Cost"];
uint64 plan_rows = 10 [json_name = "Plan Rows"];
uint64 plan_width = 11 [json_name = "Plan Width"];
repeated string output = 12 [json_name = "Output"];
repeated Plan plans = 13 [json_name = "Plans"];
// Embedded "Blocks" fields
uint64 shared_hit_blocks = 14 [json_name = "Shared Hit Blocks"];
uint64 shared_read_blocks = 15 [json_name = "Shared Read Blocks"];
uint64 shared_dirtied_blocks = 16 [json_name = "Shared Dirtied Blocks"];
uint64 shared_written_blocks = 17 [json_name = "Shared Written Blocks"];
uint64 local_hit_blocks = 18 [json_name = "Local Hit Blocks"];
uint64 local_read_blocks = 19 [json_name = "Local Read Blocks"];
uint64 local_dirtied_blocks = 20 [json_name = "Local Dirtied Blocks"];
uint64 local_written_blocks = 21 [json_name = "Local Written Blocks"];
uint64 temp_read_blocks = 22 [json_name = "Temp Read Blocks"];
uint64 temp_written_blocks = 23 [json_name = "Temp Written Blocks"];
// "Node Type": "Sort" fields
repeated string sort_key = 24 [json_name = "Sort Key"];
// "Node Type": "Hash Join" fields
string join_type = 25 [json_name = "Join Type"];
bool inner_unique = 26 [json_name = "Inner Unique"];
string hash_cond = 27 [json_name = "Hash Cond"];
// "Node Type": "Index Scan" fields
string index_name = 28 [json_name = "Index Name"];
string scan_direction = 29 [json_name = "Scan Direction"];
string index_cond = 30 [json_name = "Index Cond"];
}
message Planning {
uint64 shared_hit_blocks = 1 [json_name = "Shared Hit Blocks"];
uint64 shared_read_blocks = 2 [json_name = "Shared Read Blocks"];
uint64 shared_dirtied_blocks = 3 [json_name = "Shared Dirtied Blocks"];
uint64 shared_written_blocks = 4 [json_name = "Shared Written Blocks"];
uint64 local_hit_blocks = 5 [json_name = "Local Hit Blocks"];
uint64 local_read_blocks = 6 [json_name = "Local Read Blocks"];
uint64 local_dirtied_blocks = 7 [json_name = "Local Dirtied Blocks"];
uint64 local_written_blocks = 8 [json_name = "Local Written Blocks"];
uint64 temp_read_blocks = 9 [json_name = "Temp Read Blocks"];
uint64 temp_written_blocks = 10 [json_name = "Temp Written Blocks"];
}
}
message MySQL {
MySQLExplain explain = 1;
}
message MySQLExplain {
QueryBlock query_block = 1;
message QueryBlock {
uint64 select_id = 1;
string message = 2;
map<string, string> cost_info = 3;
Table table = 4;
OrderingOperation ordering_operation = 5;
repeated NestedLoopObj nested_loop = 6;
}
message Table {
string table_name = 1;
string access_type = 2;
uint64 rows_examined_per_scan = 3;
uint64 rows_produced_per_join = 4;
string filtered = 5;
map<string, string> cost_info = 6;
repeated string used_columns = 7;
bool insert = 8;
repeated string possible_keys = 9;
string key = 10;
repeated string used_key_parts = 11;
string key_length = 12;
repeated string ref = 13;
}
message NestedLoopObj {
Table table = 1;
}
message OrderingOperation {
bool using_filesort = 1;
map<string, string> cost_info = 2;
Table table = 3;
repeated NestedLoopObj nested_loop = 4;
}
}