diff --git a/protos/plugin/codegen.proto b/protos/plugin/codegen.proto index 1e97a10640..cb26ce6ad2 100644 --- a/protos/plugin/codegen.proto +++ b/protos/plugin/codegen.proto @@ -4,10 +4,9 @@ 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 File { + string name = 1 [json_name = "name"]; + bytes contents = 2 [json_name = "contents"]; } message Override { @@ -15,29 +14,28 @@ message Override { reserved 9; // name of the type to use, e.g. `github.com/segmentio/ksuid.KSUID` or `mymodule.Type` - string code_type = 1 [json_name="code_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"]; + 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"]; + bool nullable = 5 [json_name = "nullable"]; // fully qualified name of the column, e.g. `accounts.id` - string column = 6 [json_name="column"]; + string column = 6 [json_name = "column"]; - Identifier table = 7 [json_name="table"]; + Identifier table = 7 [json_name = "table"]; - string column_name = 8 [json_name="column_name"]; + string column_name = 8 [json_name = "column_name"]; ParsedGoType go_type = 10; - // True if the override should apply to a unsigned database type - bool unsigned = 11 [json_name="unsigned"]; + // True if the override should apply to a unsigned database type + bool unsigned = 11 [json_name = "unsigned"]; } -message ParsedGoType -{ +message ParsedGoType { string import_path = 1; string package = 2; string type_name = 3; @@ -45,34 +43,31 @@ message ParsedGoType map struct_tags = 5; } -message Settings -{ +message Settings { // PythonCode message was field 8 // KotlinCode message was field 9 reserved 8, 9; - 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 rename = 5 [json_name="rename"]; - repeated Override overrides = 6 [json_name="overrides"]; - Codegen codegen = 12 [json_name="codegen"]; + 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 rename = 5 [json_name = "rename"]; + repeated Override overrides = 6 [json_name = "overrides"]; + Codegen codegen = 12 [json_name = "codegen"]; // TODO: Refactor codegen settings GoCode go = 10; JSONCode json = 11; } -message Codegen -{ - string out = 1 [json_name="out"]; - string plugin = 2 [json_name="plugin"]; - bytes options = 3 [json_name="options"]; +message Codegen { + string out = 1 [json_name = "out"]; + string plugin = 2 [json_name = "plugin"]; + bytes options = 3 [json_name = "options"]; } -message GoCode -{ +message GoCode { bool emit_interface = 1; bool emit_json_tags = 2; bool emit_db_tags = 3; @@ -102,23 +97,20 @@ message GoCode bool omit_unused_structs = 27; } -message JSONCode -{ +message JSONCode { string out = 1; string indent = 2; string filename = 3; } -message Catalog -{ +message Catalog { string comment = 1; string default_schema = 2; string name = 3; repeated Schema schemas = 4; } -message Schema -{ +message Schema { string comment = 1; string name = 2; repeated Table tables = 3; @@ -126,35 +118,30 @@ message Schema repeated CompositeType composite_types = 5; } -message CompositeType -{ +message CompositeType { string name = 1; string comment = 2; } -message Enum -{ +message Enum { string name = 1; repeated string vals = 2; string comment = 3; } -message Table -{ +message Table { Identifier rel = 1; repeated Column columns = 2; - string comment = 3; + string comment = 3; } -message Identifier -{ +message Identifier { string catalog = 1; string schema = 2; string name = 3; } -message Column -{ +message Column { string name = 1; bool not_null = 3; bool is_array = 4; @@ -174,34 +161,30 @@ message Column bool unsigned = 16; } -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 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 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"]; - string sqlc_version = 4 [json_name="sqlc_version"]; - bytes plugin_options = 5 [json_name="plugin_options"]; +message CodeGenRequest { + 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"]; } -message CodeGenResponse -{ - repeated File files = 1 [json_name="files"]; -} \ No newline at end of file +message CodeGenResponse { + repeated File files = 1 [json_name = "files"]; +} diff --git a/protos/vet/vet.proto b/protos/vet/vet.proto index 24400cf12d..9b61b98887 100644 --- a/protos/vet/vet.proto +++ b/protos/vet/vet.proto @@ -4,25 +4,22 @@ package vet; option go_package = "github.com/kyleconroy/sqlc/internal/vet"; -message Parameter -{ - int32 number = 1 [json_name="number"]; +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 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 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 { @@ -30,62 +27,62 @@ message PostgreSQL { } message PostgreSQLExplain { - Plan plan = 1 [json_name="Plan"]; - map settings = 2 [json_name="Settings"]; - Planning planning = 3 [json_name="Planning"]; + Plan plan = 1 [json_name = "Plan"]; + map 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; + 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"]; } }