Skip to content

Commit d0db152

Browse files
fixed Rakefile and regenerated code
1 parent 491c352 commit d0db152

File tree

6 files changed

+92
-92
lines changed

6 files changed

+92
-92
lines changed

.github/workflows/docs.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ permissions:
99

1010
on:
1111
push:
12-
branches: ["main"]
12+
branches: [ "main" ]
1313
paths:
1414
- "sqlc.ci.yaml"
1515
- "examples/**"

Rakefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ task :dotnet_publish_process => [:protobuf_generate, :dotnet_format] do
2525
sh "dotnet publish LocalRunner -c release --output dist/"
2626
end
2727

28-
task :sqlc_generate_process => :dotnet_publish_process do
29-
sh "sqlc -f #{ENV['SQLC_LOCAL_FILE']} generate"
28+
task :sqlc_generate_process => [:dotnet_publish_process] do
29+
sh "sqlc -f sqlc.local.yaml generate"
3030
end
3131

3232
task :test_process_plugin => [:sqlc_generate_process, :run_tests]
@@ -37,12 +37,12 @@ task :dotnet_publish_wasm => :protobuf_generate do
3737
end
3838

3939
task :update_wasm_plugin do
40-
sh "./scripts/wasm/update_sha.sh #{ENV['SQLC_CI_FILE']}"
40+
sh "./scripts/wasm/update_sha.sh sqlc.ci.yaml"
4141
end
4242

4343
task :sqlc_generate_wasm => [:dotnet_publish_wasm, :update_wasm_plugin] do
4444
ENV['SQLCCACHE'] = './'
45-
sh "sqlc -f #{ENV['SQLC_CI_FILE']} generate"
45+
sh "sqlc -f sqlc.ci.yaml generate"
4646
end
4747

4848
task :test_wasm_plugin => [:sqlc_generate_wasm, :update_wasm_plugin, :run_tests]

examples/mysql2/query_sql.rb

+53-53
Original file line numberDiff line numberDiff line change
@@ -6,46 +6,46 @@ module Mysql2Codegen
66
GetAuthorSql = %q(SELECT id, name, bio FROM authors
77
WHERE id = ? LIMIT 1)
88

9-
GetAuthorRow = Data.define( :id, :name, :bio)
9+
GetAuthorRow = Struct.new( :id, :name, :bio)
1010

11-
GetAuthorArgs = Data.define( :id)
11+
GetAuthorArgs = Struct.new( :id)
1212

1313
ListAuthorsSql = %q(SELECT id, name, bio FROM authors
1414
ORDER BY name)
1515

16-
ListAuthorsRow = Data.define( :id, :name, :bio)
16+
ListAuthorsRow = Struct.new( :id, :name, :bio)
1717

1818
CreateAuthorSql = %q(INSERT INTO authors (
1919
name, bio
2020
) VALUES (
2121
?, ?
2222
))
2323

24-
CreateAuthorArgs = Data.define( :name, :bio)
24+
CreateAuthorArgs = Struct.new( :name, :bio)
2525

2626
UpdateAuthorSql = %q(UPDATE authors
2727
SET bio = ?
2828
WHERE id = ?)
2929

30-
UpdateAuthorArgs = Data.define( :bio, :id)
30+
UpdateAuthorArgs = Struct.new( :bio, :id)
3131

3232
CreateAuthorReturnIdSql = %q(INSERT INTO authors (
3333
name, bio
3434
) VALUES (
3535
?, ?
3636
))
3737

38-
CreateAuthorReturnIdArgs = Data.define( :name, :bio)
38+
CreateAuthorReturnIdArgs = Struct.new( :name, :bio)
3939

4040
DeleteAuthorSql = %q(DELETE FROM authors
4141
WHERE id = ?)
4242

43-
DeleteAuthorArgs = Data.define( :id)
43+
DeleteAuthorArgs = Struct.new( :id)
4444

4545
TestSql = %q(SELECT c_bit, c_tinyint, c_bool, c_boolean, c_smallint, c_mediumint, c_int, c_integer, c_bigint, c_serial, c_decimal, c_dec, c_numeric, c_fixed, c_float, c_double, c_double_precision, c_date, c_time, c_datetime, c_timestamp, c_year, c_char, c_nchar, c_national_char, c_varchar, c_binary, c_varbinary, c_tinyblob, c_tinytext, c_blob, c_text, c_mediumblob, c_mediumtext, c_longblob, c_longtext, c_json FROM node_mysql_types
4646
LIMIT 1)
4747

48-
TestRow = Data.define(
48+
TestRow = Struct.new(
4949
:c_bit,
5050
:c_tinyint,
5151
:c_bool,
@@ -92,14 +92,14 @@ def initialize(connection_pool_params, mysql2_params)
9292

9393
def get_author(get_author_args)
9494
@pool.with do |client|
95-
query_params = [get_author_args.id]
95+
query_params = [ get_author_args.id]
9696
stmt = client.prepare(GetAuthorSql)
9797
result = stmt.execute(*query_params)
9898
row = result.first
9999
return nil if row.nil?
100100
entity = GetAuthorRow.new(
101-
row['id'],
102-
row['name'],
101+
row['id']
102+
row['name']
103103
row['bio']
104104
)
105105
return entity
@@ -113,8 +113,8 @@ def list_authors
113113
entities = []
114114
result.each do |row|
115115
entities << ListAuthorsRow.new(
116-
row['id'],
117-
row['name'],
116+
row['id']
117+
row['name']
118118
row['bio']
119119
)
120120
end
@@ -124,23 +124,23 @@ def list_authors
124124

125125
def create_author(create_author_args)
126126
@pool.with do |client|
127-
query_params = [create_author_args.name, create_author_args.bio]
127+
query_params = [ create_author_args.name, create_author_args.bio]
128128
stmt = client.prepare(CreateAuthorSql)
129129
stmt.execute(*query_params)
130130
end
131131
end
132132

133133
def update_author(update_author_args)
134134
@pool.with do |client|
135-
query_params = [update_author_args.bio, update_author_args.id]
135+
query_params = [ update_author_args.bio, update_author_args.id]
136136
stmt = client.prepare(UpdateAuthorSql)
137137
stmt.execute(*query_params)
138138
end
139139
end
140140

141141
def create_author_return_id(create_author_return_id_args)
142142
@pool.with do |client|
143-
query_params = [create_author_return_id_args.name, create_author_return_id_args.bio]
143+
query_params = [ create_author_return_id_args.name, create_author_return_id_args.bio]
144144
stmt = client.prepare(CreateAuthorReturnIdSql)
145145
stmt.execute(*query_params)
146146
return client.last_id
@@ -149,7 +149,7 @@ def create_author_return_id(create_author_return_id_args)
149149

150150
def delete_author(delete_author_args)
151151
@pool.with do |client|
152-
query_params = [delete_author_args.id]
152+
query_params = [ delete_author_args.id]
153153
stmt = client.prepare(DeleteAuthorSql)
154154
stmt.execute(*query_params)
155155
end
@@ -162,42 +162,42 @@ def test
162162
row = result.first
163163
return nil if row.nil?
164164
entity = TestRow.new(
165-
row['c_bit'],
166-
row['c_tinyint'],
167-
row['c_bool'],
168-
row['c_boolean'],
169-
row['c_smallint'],
170-
row['c_mediumint'],
171-
row['c_int'],
172-
row['c_integer'],
173-
row['c_bigint'],
174-
row['c_serial'],
175-
row['c_decimal'],
176-
row['c_dec'],
177-
row['c_numeric'],
178-
row['c_fixed'],
179-
row['c_float'],
180-
row['c_double'],
181-
row['c_double_precision'],
182-
row['c_date'],
183-
row['c_time'],
184-
row['c_datetime'],
185-
row['c_timestamp'],
186-
row['c_year'],
187-
row['c_char'],
188-
row['c_nchar'],
189-
row['c_national_char'],
190-
row['c_varchar'],
191-
row['c_binary'],
192-
row['c_varbinary'],
193-
row['c_tinyblob'],
194-
row['c_tinytext'],
195-
row['c_blob'],
196-
row['c_text'],
197-
row['c_mediumblob'],
198-
row['c_mediumtext'],
199-
row['c_longblob'],
200-
row['c_longtext'],
165+
row['c_bit']
166+
row['c_tinyint']
167+
row['c_bool']
168+
row['c_boolean']
169+
row['c_smallint']
170+
row['c_mediumint']
171+
row['c_int']
172+
row['c_integer']
173+
row['c_bigint']
174+
row['c_serial']
175+
row['c_decimal']
176+
row['c_dec']
177+
row['c_numeric']
178+
row['c_fixed']
179+
row['c_float']
180+
row['c_double']
181+
row['c_double_precision']
182+
row['c_date']
183+
row['c_time']
184+
row['c_datetime']
185+
row['c_timestamp']
186+
row['c_year']
187+
row['c_char']
188+
row['c_nchar']
189+
row['c_national_char']
190+
row['c_varchar']
191+
row['c_binary']
192+
row['c_varbinary']
193+
row['c_tinyblob']
194+
row['c_tinytext']
195+
row['c_blob']
196+
row['c_text']
197+
row['c_mediumblob']
198+
row['c_mediumtext']
199+
row['c_longblob']
200+
row['c_longtext']
201201
row['c_json']
202202
)
203203
return entity

examples/pg/query_sql.rb

+33-33
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ module PgCodegen
77
GetAuthorSql = %q(SELECT id, name, bio FROM authors
88
WHERE id = $1 LIMIT 1)
99

10-
GetAuthorRow = Data.define( :id, :name, :bio)
10+
GetAuthorRow = Struct.new( :id, :name, :bio)
1111

12-
GetAuthorArgs = Data.define( :id)
12+
GetAuthorArgs = Struct.new( :id)
1313

1414
ListAuthorsSql = %q(SELECT id, name, bio FROM authors
1515
ORDER BY name)
1616

17-
ListAuthorsRow = Data.define( :id, :name, :bio)
17+
ListAuthorsRow = Struct.new( :id, :name, :bio)
1818

1919
CreateAuthorSql = %q(INSERT INTO authors (
2020
name, bio
@@ -23,19 +23,19 @@ module PgCodegen
2323
)
2424
RETURNING id, name, bio)
2525

26-
CreateAuthorRow = Data.define( :id, :name, :bio)
26+
CreateAuthorRow = Struct.new( :id, :name, :bio)
2727

28-
CreateAuthorArgs = Data.define( :name, :bio)
28+
CreateAuthorArgs = Struct.new( :name, :bio)
2929

3030
DeleteAuthorSql = %q(DELETE FROM authors
3131
WHERE id = $1)
3232

33-
DeleteAuthorArgs = Data.define( :id)
33+
DeleteAuthorArgs = Struct.new( :id)
3434

3535
TestSql = %q(SELECT c_bit, c_smallint, c_boolean, c_integer, c_bigint, c_serial, c_decimal, c_numeric, c_real, c_double_precision, c_date, c_time, c_timestamp, c_char, c_varchar, c_bytea, c_text, c_json FROM node_postgres_types
3636
LIMIT 1)
3737

38-
TestRow = Data.define(
38+
TestRow = Struct.new(
3939
:c_bit,
4040
:c_smallint,
4141
:c_boolean,
@@ -70,7 +70,7 @@ def initialize(connection_pool_params, pg_params)
7070

7171
def get_author(get_author_args)
7272
@pool.with do |client|
73-
query_params = [get_author_args.id]
73+
query_params = [ get_author_args.id]
7474
unless @prepared_statements.include?('get_author')
7575
client.prepare('get_author', GetAuthorSql)
7676
@prepared_statements.add('get_author')
@@ -79,8 +79,8 @@ def get_author(get_author_args)
7979
row = result.first
8080
return nil if row.nil?
8181
entity = GetAuthorRow.new(
82-
row['id'],
83-
row['name'],
82+
row['id']
83+
row['name']
8484
row['bio']
8585
)
8686
return entity
@@ -97,8 +97,8 @@ def list_authors
9797
entities = []
9898
result.each do |row|
9999
entities << ListAuthorsRow.new(
100-
row['id'],
101-
row['name'],
100+
row['id']
101+
row['name']
102102
row['bio']
103103
)
104104
end
@@ -108,7 +108,7 @@ def list_authors
108108

109109
def create_author(create_author_args)
110110
@pool.with do |client|
111-
query_params = [create_author_args.name, create_author_args.bio]
111+
query_params = [ create_author_args.name, create_author_args.bio]
112112
unless @prepared_statements.include?('create_author')
113113
client.prepare('create_author', CreateAuthorSql)
114114
@prepared_statements.add('create_author')
@@ -117,8 +117,8 @@ def create_author(create_author_args)
117117
row = result.first
118118
return nil if row.nil?
119119
entity = CreateAuthorRow.new(
120-
row['id'],
121-
row['name'],
120+
row['id']
121+
row['name']
122122
row['bio']
123123
)
124124
return entity
@@ -127,7 +127,7 @@ def create_author(create_author_args)
127127

128128
def delete_author(delete_author_args)
129129
@pool.with do |client|
130-
query_params = [delete_author_args.id]
130+
query_params = [ delete_author_args.id]
131131
unless @prepared_statements.include?('delete_author')
132132
client.prepare('delete_author', DeleteAuthorSql)
133133
@prepared_statements.add('delete_author')
@@ -146,23 +146,23 @@ def test
146146
row = result.first
147147
return nil if row.nil?
148148
entity = TestRow.new(
149-
row['c_bit'],
150-
row['c_smallint'],
151-
row['c_boolean'],
152-
row['c_integer'],
153-
row['c_bigint'],
154-
row['c_serial'],
155-
row['c_decimal'],
156-
row['c_numeric'],
157-
row['c_real'],
158-
row['c_double_precision'],
159-
row['c_date'],
160-
row['c_time'],
161-
row['c_timestamp'],
162-
row['c_char'],
163-
row['c_varchar'],
164-
row['c_bytea'],
165-
row['c_text'],
149+
row['c_bit']
150+
row['c_smallint']
151+
row['c_boolean']
152+
row['c_integer']
153+
row['c_bigint']
154+
row['c_serial']
155+
row['c_decimal']
156+
row['c_numeric']
157+
row['c_real']
158+
row['c_double_precision']
159+
row['c_date']
160+
row['c_time']
161+
row['c_timestamp']
162+
row['c_char']
163+
row['c_varchar']
164+
row['c_bytea']
165+
row['c_text']
166166
row['c_json']
167167
)
168168
return entity

sqlc.ci.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ plugins:
33
- name: ruby
44
wasm:
55
url: file://dist/plugin.wasm
6-
sha256: 8f18f3158b9ff9396e27a4084512473cbe304e5ef205ac21741c1bc6094fd079
6+
sha256: SHA_TO_REPLACE
77
sql:
88
- schema: "examples/authors/postgresql/schema.sql"
99
queries: "examples/authors/postgresql/query.sql"

0 commit comments

Comments
 (0)