Skip to content

Commit 29ade26

Browse files
authored
Merge branch 'main' into patch-1
2 parents 9901a99 + 5ee2c0b commit 29ade26

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+726
-151
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
- uses: actions/checkout@v4
3131
- uses: actions/setup-go@v5
3232
with:
33-
go-version: '1.22.5'
33+
go-version: '1.22.8'
3434

3535
- name: install gotestsum
3636
run: go install gotest.tools/gotestsum@latest
@@ -78,6 +78,6 @@ jobs:
7878
- uses: actions/checkout@v4
7979
- uses: actions/setup-go@v5
8080
with:
81-
go-version: '1.22.5'
81+
go-version: '1.22.8'
8282
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
8383
- run: govulncheck ./...

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# STEP 1: Build sqlc
2-
FROM golang:1.23.1 AS builder
2+
FROM golang:1.23.3 AS builder
33

44
COPY . /workspace
55
WORKDIR /workspace

docs/howto/vet.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,24 @@ rules:
259259
### Opting-out of lint rules
260260

261261
For any query, you can tell `sqlc vet` not to evaluate lint rules using the
262-
`@sqlc-vet-disable` query annotation.
262+
`@sqlc-vet-disable` query annotation. The annotation accepts a list of rules to ignore.
263+
264+
```sql
265+
/* name: GetAuthor :one */
266+
/* @sqlc-vet-disable sqlc/db-prepare no-pg */
267+
SELECT * FROM authors
268+
WHERE id = ? LIMIT 1;
269+
```
270+
The rules can also be split across lines.
271+
```sql
272+
/* name: GetAuthor :one */
273+
/* @sqlc-vet-disable sqlc/db-prepare */
274+
/* @sqlc-vet-disable no-pg */
275+
SELECT * FROM authors
276+
WHERE id = ? LIMIT 1;
277+
```
278+
279+
To skip all rules for a query, you can provide the `@sqlc-vet-disable` annotation without any parameters.
263280

264281
```sql
265282
/* name: GetAuthor :one */

docs/reference/config.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ The `gen` mapping supports the following keys:
135135
- Output directory for generated code.
136136
- `sql_package`:
137137
- Either `pgx/v4`, `pgx/v5` or `database/sql`. Defaults to `database/sql`.
138+
- `sql_driver`:
139+
- Either `github.com/jackc/pgx/v4`, `github.com/jackc/pgx/v5`, `github.com/lib/pq` or `github.com/go-sql-driver/mysql`. No defaults. Required if query annotation `:copyfrom` is used.
138140
- `emit_db_tags`:
139141
- If true, add DB tags to generated structs. Defaults to `false`.
140142
- `emit_prepared_queries`:

docs/reference/datatypes.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to stor
158158
## JSON
159159

160160
By default, sqlc will generate the `[]byte`, `pgtype.JSON` or `json.RawMessage` for JSON column type.
161-
But if you use the `pgx/v5` sql package then you can specify a some struct instead of default type.
162-
The `pgx` implementation will marshall/unmarshall the struct automatically.
161+
But if you use the `pgx/v5` sql package then you can specify a struct instead of default type.
162+
The `pgx` implementation will marshal/unmarshal the struct automatically.
163163

164164
```go
165165
package dto

docs/reference/language-support.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ New languages can be added via :doc:`plugins <../guides/plugins>`.
2020
Language Plugin MySQL PostgreSQL SQLite
2121
======== ================================= =============== ============ ===============
2222
F# `kaashyapan/sqlc-gen-fsharp`_ Not implemented Beta Beta
23-
C# `DaredevilOSS/sqlc-gen-csharp`_ Beta Beta Not implemented
23+
C# `DaredevilOSS/sqlc-gen-csharp`_ Beta Beta Beta
2424
Ruby `DaredevilOSS/sqlc-gen-ruby`_ Beta Beta Beta
2525
[Any] `fdietze/sqlc-gen-from-template`_ Stable Stable Stable
2626
======== ================================= =============== ============ ===============

docs/reference/query-annotations.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,3 +222,9 @@ func (b *CreateBookBatchResults) Close() error {
222222
//...
223223
}
224224
```
225+
226+
## `:copyfrom`
227+
228+
__NOTE: This command is driver and package specific, see [how to insert](../howto/insert.md#using-copyfrom)
229+
230+
This command is used to insert rows a lot faster than sequential inserts.

docs/requirements.txt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
11
Babel==2.16.0
22
Jinja2==3.1.4
3-
MarkupSafe==2.1.5
3+
MarkupSafe==3.0.2
44
Pygments==2.18.0
55
Sphinx==7.4.7
66
certifi==2024.8.30
77
chardet==5.2.0
88
commonmark==0.9.1
99
docutils==0.20.1
10-
idna==3.8
10+
idna==3.10
1111
imagesize==1.4.1
1212
myst-parser==4.0.0
13-
packaging==24.1
14-
pyparsing==3.1.4
15-
pytz==2024.1
13+
packaging==24.2
14+
pyparsing==3.2.0
15+
pytz==2024.2
1616
requests==2.32.3
1717
snowballstemmer==2.2.0
1818
sphinx-favicon==1.0.1
19-
sphinx-rtd-theme==2.0.0
19+
sphinx-rtd-theme==3.0.2
2020
sphinxcontrib-applehelp==2.0.0
2121
sphinxcontrib-devhelp==2.0.0
2222
sphinxcontrib-htmlhelp==2.1.0
2323
sphinxcontrib-jsmath==1.0.1
2424
sphinxcontrib-qthelp==2.0.0
2525
sphinxcontrib-serializinghtml==2.0.0
2626
sphinxext-rediraffe==0.2.7
27-
urllib3==2.2.2
27+
urllib3==2.2.3

docs/tutorials/getting-started-sqlite.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ import (
128128
"log"
129129
"reflect"
130130
131-
_ "github.com/mattn/go-sqlite3"
131+
_ "modernc.org/sqlite"
132132
133133
"tutorial.sqlc.dev/app/tutorial"
134134
)
@@ -139,7 +139,7 @@ var ddl string
139139
func run() error {
140140
ctx := context.Background()
141141
142-
db, err := sql.Open("sqlite3", ":memory:")
142+
db, err := sql.Open("sqlite", ":memory:")
143143
if err != nil {
144144
return err
145145
}

go.mod

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,36 @@
11
module github.com/sqlc-dev/sqlc
22

3-
go 1.22
4-
5-
toolchain go1.22.5
3+
go 1.22.9
64

75
require (
86
github.com/antlr4-go/antlr/v4 v4.13.1
97
github.com/cubicdaiya/gonp v1.0.4
108
github.com/davecgh/go-spew v1.1.1
119
github.com/fatih/structtag v1.2.0
1210
github.com/go-sql-driver/mysql v1.8.1
13-
github.com/google/cel-go v0.21.0
11+
github.com/google/cel-go v0.22.1
1412
github.com/google/go-cmp v0.6.0
1513
github.com/jackc/pgx/v4 v4.18.3
16-
github.com/jackc/pgx/v5 v5.6.0
14+
github.com/jackc/pgx/v5 v5.7.1
1715
github.com/jinzhu/inflection v1.0.0
1816
github.com/lib/pq v1.10.9
1917
github.com/pganalyze/pg_query_go/v5 v5.1.0
2018
github.com/pingcap/tidb/pkg/parser v0.0.0-20231103154709-4f00ece106b1
2119
github.com/riza-io/grpc-go v0.2.0
2220
github.com/spf13/cobra v1.8.1
2321
github.com/spf13/pflag v1.0.5
24-
github.com/tetratelabs/wazero v1.8.0
22+
github.com/tetratelabs/wazero v1.8.2
2523
github.com/wasilibs/go-pgquery v0.0.0-20240606042535-c0843d6592cc
2624
github.com/xeipuuv/gojsonschema v1.2.0
27-
golang.org/x/sync v0.8.0
28-
google.golang.org/grpc v1.66.0
29-
google.golang.org/protobuf v1.34.2
25+
golang.org/x/sync v0.9.0
26+
google.golang.org/grpc v1.68.0
27+
google.golang.org/protobuf v1.35.2
3028
gopkg.in/yaml.v3 v3.0.1
31-
modernc.org/sqlite v1.32.0
29+
modernc.org/sqlite v1.34.2
3230
)
3331

3432
require (
33+
cel.dev/expr v0.18.0 // indirect
3534
filippo.io/edwards25519 v1.1.0 // indirect
3635
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
3736
github.com/dustin/go-humanize v1.0.1 // indirect
@@ -43,9 +42,9 @@ require (
4342
github.com/jackc/pgio v1.0.0 // indirect
4443
github.com/jackc/pgpassfile v1.0.0 // indirect
4544
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
46-
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
45+
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
4746
github.com/jackc/pgtype v1.14.0 // indirect
48-
github.com/jackc/puddle/v2 v2.2.1 // indirect
47+
github.com/jackc/puddle/v2 v2.2.2 // indirect
4948
github.com/mattn/go-isatty v0.0.20 // indirect
5049
github.com/ncruces/go-strftime v0.1.9 // indirect
5150
github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 // indirect
@@ -60,13 +59,13 @@ require (
6059
go.uber.org/atomic v1.11.0 // indirect
6160
go.uber.org/multierr v1.11.0 // indirect
6261
go.uber.org/zap v1.26.0 // indirect
63-
golang.org/x/crypto v0.24.0 // indirect
62+
golang.org/x/crypto v0.27.0 // indirect
6463
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
65-
golang.org/x/net v0.26.0 // indirect
66-
golang.org/x/sys v0.22.0 // indirect
67-
golang.org/x/text v0.16.0 // indirect
68-
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
69-
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
64+
golang.org/x/net v0.29.0 // indirect
65+
golang.org/x/sys v0.25.0 // indirect
66+
golang.org/x/text v0.18.0 // indirect
67+
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
68+
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
7069
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
7170
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
7271
modernc.org/libc v1.55.3 // indirect

0 commit comments

Comments
 (0)