Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
kyleconroy authored Dec 2, 2024
2 parents 9901a99 + 5ee2c0b commit 29ade26
Show file tree
Hide file tree
Showing 61 changed files with 726 additions and 151 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.5'
go-version: '1.22.8'

- name: install gotestsum
run: go install gotest.tools/gotestsum@latest
Expand Down Expand Up @@ -78,6 +78,6 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.22.5'
go-version: '1.22.8'
- run: go install golang.org/x/vuln/cmd/govulncheck@latest
- run: govulncheck ./...
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# STEP 1: Build sqlc
FROM golang:1.23.1 AS builder
FROM golang:1.23.3 AS builder

COPY . /workspace
WORKDIR /workspace
Expand Down
19 changes: 18 additions & 1 deletion docs/howto/vet.md
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,24 @@ rules:
### Opting-out of lint rules

For any query, you can tell `sqlc vet` not to evaluate lint rules using the
`@sqlc-vet-disable` query annotation.
`@sqlc-vet-disable` query annotation. The annotation accepts a list of rules to ignore.

```sql
/* name: GetAuthor :one */
/* @sqlc-vet-disable sqlc/db-prepare no-pg */
SELECT * FROM authors
WHERE id = ? LIMIT 1;
```
The rules can also be split across lines.
```sql
/* name: GetAuthor :one */
/* @sqlc-vet-disable sqlc/db-prepare */
/* @sqlc-vet-disable no-pg */
SELECT * FROM authors
WHERE id = ? LIMIT 1;
```

To skip all rules for a query, you can provide the `@sqlc-vet-disable` annotation without any parameters.

```sql
/* name: GetAuthor :one */
Expand Down
2 changes: 2 additions & 0 deletions docs/reference/config.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ The `gen` mapping supports the following keys:
- Output directory for generated code.
- `sql_package`:
- Either `pgx/v4`, `pgx/v5` or `database/sql`. Defaults to `database/sql`.
- `sql_driver`:
- 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.
- `emit_db_tags`:
- If true, add DB tags to generated structs. Defaults to `false`.
- `emit_prepared_queries`:
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/datatypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ For MySQL, there is no native `uuid` data type. When using `UUID_TO_BIN` to stor
## JSON

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

```go
package dto
Expand Down
2 changes: 1 addition & 1 deletion docs/reference/language-support.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ New languages can be added via :doc:`plugins <../guides/plugins>`.
Language Plugin MySQL PostgreSQL SQLite
======== ================================= =============== ============ ===============
F# `kaashyapan/sqlc-gen-fsharp`_ Not implemented Beta Beta
C# `DaredevilOSS/sqlc-gen-csharp`_ Beta Beta Not implemented
C# `DaredevilOSS/sqlc-gen-csharp`_ Beta Beta Beta
Ruby `DaredevilOSS/sqlc-gen-ruby`_ Beta Beta Beta
[Any] `fdietze/sqlc-gen-from-template`_ Stable Stable Stable
======== ================================= =============== ============ ===============
Expand Down
6 changes: 6 additions & 0 deletions docs/reference/query-annotations.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,3 +222,9 @@ func (b *CreateBookBatchResults) Close() error {
//...
}
```

## `:copyfrom`

__NOTE: This command is driver and package specific, see [how to insert](../howto/insert.md#using-copyfrom)

This command is used to insert rows a lot faster than sequential inserts.
14 changes: 7 additions & 7 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
Babel==2.16.0
Jinja2==3.1.4
MarkupSafe==2.1.5
MarkupSafe==3.0.2
Pygments==2.18.0
Sphinx==7.4.7
certifi==2024.8.30
chardet==5.2.0
commonmark==0.9.1
docutils==0.20.1
idna==3.8
idna==3.10
imagesize==1.4.1
myst-parser==4.0.0
packaging==24.1
pyparsing==3.1.4
pytz==2024.1
packaging==24.2
pyparsing==3.2.0
pytz==2024.2
requests==2.32.3
snowballstemmer==2.2.0
sphinx-favicon==1.0.1
sphinx-rtd-theme==2.0.0
sphinx-rtd-theme==3.0.2
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
sphinxext-rediraffe==0.2.7
urllib3==2.2.2
urllib3==2.2.3
4 changes: 2 additions & 2 deletions docs/tutorials/getting-started-sqlite.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ import (
"log"
"reflect"
_ "github.com/mattn/go-sqlite3"
_ "modernc.org/sqlite"
"tutorial.sqlc.dev/app/tutorial"
)
Expand All @@ -139,7 +139,7 @@ var ddl string
func run() error {
ctx := context.Background()
db, err := sql.Open("sqlite3", ":memory:")
db, err := sql.Open("sqlite", ":memory:")
if err != nil {
return err
}
Expand Down
35 changes: 17 additions & 18 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,37 +1,36 @@
module github.com/sqlc-dev/sqlc

go 1.22

toolchain go1.22.5
go 1.22.9

require (
github.com/antlr4-go/antlr/v4 v4.13.1
github.com/cubicdaiya/gonp v1.0.4
github.com/davecgh/go-spew v1.1.1
github.com/fatih/structtag v1.2.0
github.com/go-sql-driver/mysql v1.8.1
github.com/google/cel-go v0.21.0
github.com/google/cel-go v0.22.1
github.com/google/go-cmp v0.6.0
github.com/jackc/pgx/v4 v4.18.3
github.com/jackc/pgx/v5 v5.6.0
github.com/jackc/pgx/v5 v5.7.1
github.com/jinzhu/inflection v1.0.0
github.com/lib/pq v1.10.9
github.com/pganalyze/pg_query_go/v5 v5.1.0
github.com/pingcap/tidb/pkg/parser v0.0.0-20231103154709-4f00ece106b1
github.com/riza-io/grpc-go v0.2.0
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
github.com/tetratelabs/wazero v1.8.0
github.com/tetratelabs/wazero v1.8.2
github.com/wasilibs/go-pgquery v0.0.0-20240606042535-c0843d6592cc
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/sync v0.8.0
google.golang.org/grpc v1.66.0
google.golang.org/protobuf v1.34.2
golang.org/x/sync v0.9.0
google.golang.org/grpc v1.68.0
google.golang.org/protobuf v1.35.2
gopkg.in/yaml.v3 v3.0.1
modernc.org/sqlite v1.32.0
modernc.org/sqlite v1.34.2
)

require (
cel.dev/expr v0.18.0 // indirect
filippo.io/edwards25519 v1.1.0 // indirect
github.com/cznic/mathutil v0.0.0-20181122101859-297441e03548 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
Expand All @@ -43,9 +42,9 @@ require (
github.com/jackc/pgio v1.0.0 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgproto3/v2 v2.3.3 // indirect
github.com/jackc/pgservicefile v0.0.0-20221227161230-091c0ba34f0a // indirect
github.com/jackc/pgservicefile v0.0.0-20240606120523-5a60cdf6a761 // indirect
github.com/jackc/pgtype v1.14.0 // indirect
github.com/jackc/puddle/v2 v2.2.1 // indirect
github.com/jackc/puddle/v2 v2.2.2 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pingcap/errors v0.11.5-0.20210425183316-da1aaba5fb63 // indirect
Expand All @@ -60,13 +59,13 @@ require (
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.26.0 // indirect
golang.org/x/crypto v0.24.0 // indirect
golang.org/x/crypto v0.27.0 // indirect
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240604185151-ef581f913117 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240604185151-ef581f913117 // indirect
golang.org/x/net v0.29.0 // indirect
golang.org/x/sys v0.25.0 // indirect
golang.org/x/text v0.18.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
modernc.org/gc/v3 v3.0.0-20240107210532-573471604cb6 // indirect
modernc.org/libc v1.55.3 // indirect
Expand Down
Loading

0 comments on commit 29ade26

Please sign in to comment.