Skip to content

Commit 95b7a63

Browse files
committed
Merge remote-tracking branch 'refs/remotes/origin/main' into 4513-pg-tc
# Conflicts: # go.mod # go.sum
2 parents 28d7f3a + 22d878a commit 95b7a63

94 files changed

Lines changed: 2603 additions & 373 deletions

Some content is hidden

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

.github/workflows/buf.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,6 @@ jobs:
88
build:
99
runs-on: ubuntu-latest
1010
steps:
11-
- uses: actions/checkout@v6
11+
- uses: actions/checkout@v7
1212
- uses: bufbuild/buf-setup-action@v1
1313
- uses: bufbuild/buf-lint-action@v1

.github/workflows/build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ jobs:
99
name: build ${{ matrix.os }}
1010
runs-on: ${{ matrix.os }}
1111
steps:
12-
- uses: actions/checkout@v6
12+
- uses: actions/checkout@v7
1313
- uses: actions/setup-go@v6
1414
with:
15-
go-version: '1.26.2'
15+
go-version: '1.26.4'
1616
- name: install ./...
1717
run: go build ./...
1818
env:

.github/workflows/ci-kotlin.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
name: test
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@v7
2020
- uses: actions/setup-go@v6
2121
with:
22-
go-version: '1.26.2'
22+
go-version: '1.26.4'
2323
- name: install ./...
2424
run: go install ./...
25-
- uses: actions/checkout@v6
25+
- uses: actions/checkout@v7
2626
with:
2727
repository: sqlc-dev/sqlc-gen-kotlin
2828
path: kotlin

.github/workflows/ci-python.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
name: test
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@v7
2020
- uses: actions/setup-go@v6
2121
with:
22-
go-version: '1.26.2'
22+
go-version: '1.26.4'
2323
- name: install ./...
2424
run: go install ./...
25-
- uses: actions/checkout@v6
25+
- uses: actions/checkout@v7
2626
with:
2727
repository: sqlc-dev/sqlc-gen-python
2828
path: python

.github/workflows/ci-typescript.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ jobs:
1616
name: test
1717
runs-on: ubuntu-latest
1818
steps:
19-
- uses: actions/checkout@v6
19+
- uses: actions/checkout@v7
2020
- uses: actions/setup-go@v6
2121
with:
22-
go-version: '1.26.2'
22+
go-version: '1.26.4'
2323
- name: install ./...
2424
run: go install ./...
25-
- uses: actions/checkout@v6
25+
- uses: actions/checkout@v7
2626
with:
2727
repository: sqlc-dev/sqlc-gen-typescript
2828
path: typescript

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ jobs:
1313
name: build ${{ matrix.goos }}/${{ matrix.goarch }}
1414
runs-on: ubuntu-24.04
1515
steps:
16-
- uses: actions/checkout@v6
16+
- uses: actions/checkout@v7
1717
- uses: actions/setup-go@v6
1818
with:
19-
go-version: '1.26.2'
19+
go-version: '1.26.4'
2020
- run: go build ./...
2121
env:
2222
CGO_ENABLED: "0"
@@ -25,10 +25,10 @@ jobs:
2525
test:
2626
runs-on: ubuntu-24.04
2727
steps:
28-
- uses: actions/checkout@v6
28+
- uses: actions/checkout@v7
2929
- uses: actions/setup-go@v6
3030
with:
31-
go-version: '1.26.2'
31+
go-version: '1.26.4'
3232

3333
- name: install gotestsum
3434
run: go install gotest.tools/gotestsum@latest

.github/workflows/gen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
# needed because the postgres container does not provide a healthcheck
1818
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
1919
steps:
20-
- uses: actions/checkout@v6
20+
- uses: actions/checkout@v7
2121
- uses: actions/setup-go@v6
2222
with:
2323
go-version-file: go.mod

CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ This document provides essential information for working with the sqlc codebase,
66

77
### Prerequisites
88

9-
- **Go 1.26.2+** - Required for building and testing
9+
- **Go 1.26.4+** - Required for building and testing
1010
- **Docker & Docker Compose** - Required for integration tests with databases (local development)
1111
- **Git** - For version control
1212

@@ -147,7 +147,7 @@ make start # Start database containers
147147
### GitHub Actions Workflow
148148

149149
- **File:** `.github/workflows/ci.yml`
150-
- **Go Version:** 1.26.2
150+
- **Go Version:** 1.26.4
151151
- **Database Setup:** Uses `sqlc-test-setup` (not Docker) to install and start PostgreSQL and MySQL directly on the runner
152152
- **Test Command:** `gotestsum --junitfile junit.xml -- --tags=examples -timeout 20m ./...`
153153
- **Additional Checks:** `govulncheck` for vulnerability scanning

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.26.3 AS builder
2+
FROM golang:1.26.4 AS builder
33

44
COPY . /workspace
55
WORKDIR /workspace

docs/howto/analyze.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# `analyze` - Analyzing query result types
2+
3+
`sqlc analyze` analyzes a query against a schema and prints the inferred result
4+
columns and parameters as a single JSON document.
5+
6+
Unlike [`generate`](generate.md), this command does not require a configuration
7+
file and does not connect to a database. It uses sqlc's native static analysis
8+
to infer types directly from the provided schema.
9+
10+
## Usage
11+
12+
```sh
13+
sqlc analyze --dialect <dialect> --schema <schema-file> [query-file]
14+
```
15+
16+
The query is read from the given file, or from standard input when no file is
17+
provided. The schema is always read from the `--schema` file.
18+
19+
## Flags
20+
21+
- `--dialect`, `-d` - The SQL dialect to use. One of `postgresql`, `mysql`, or
22+
`sqlite`. Required.
23+
- `--schema`, `-s` - Path to the schema (DDL) file. Required.
24+
- `--ast` - Include each statement's AST in the output. Defaults to `false`.
25+
26+
## Examples
27+
28+
Given a schema in `schema.sql`:
29+
30+
```sql
31+
CREATE TABLE authors (
32+
id BIGSERIAL PRIMARY KEY,
33+
name text NOT NULL,
34+
bio text
35+
);
36+
```
37+
38+
and a query in `query.sql`:
39+
40+
```sql
41+
-- name: GetAuthor :one
42+
SELECT * FROM authors WHERE id = $1;
43+
```
44+
45+
Running:
46+
47+
```sh
48+
sqlc analyze --dialect postgresql --schema schema.sql query.sql
49+
```
50+
51+
reports the result columns and parameters:
52+
53+
```json
54+
[
55+
{
56+
"name": "GetAuthor",
57+
"cmd": ":one",
58+
"columns": [
59+
{
60+
"name": "id",
61+
"data_type": "bigserial",
62+
"not_null": true,
63+
"is_array": false,
64+
"table": "authors"
65+
},
66+
{
67+
"name": "name",
68+
"data_type": "text",
69+
"not_null": true,
70+
"is_array": false,
71+
"table": "authors"
72+
},
73+
{
74+
"name": "bio",
75+
"data_type": "text",
76+
"not_null": false,
77+
"is_array": false,
78+
"table": "authors"
79+
}
80+
],
81+
"params": [
82+
{
83+
"number": 1,
84+
"column": {
85+
"name": "id",
86+
"data_type": "bigserial",
87+
"not_null": true,
88+
"is_array": false,
89+
"table": "authors"
90+
}
91+
}
92+
]
93+
}
94+
]
95+
```
96+
97+
Pass `--ast` to also include each statement's parsed AST under an `ast` key.

0 commit comments

Comments
 (0)